Go to the documentation of this file.00001 #ifndef _ROS_controller_manager_msgs_ControllerStatistics_h
00002 #define _ROS_controller_manager_msgs_ControllerStatistics_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "ros/time.h"
00009 #include "ros/duration.h"
00010
00011 namespace controller_manager_msgs
00012 {
00013
00014 class ControllerStatistics : public ros::Msg
00015 {
00016 public:
00017 const char* name;
00018 const char* type;
00019 ros::Time timestamp;
00020 bool running;
00021 ros::Duration max_time;
00022 ros::Duration mean_time;
00023 ros::Duration variance_time;
00024 int32_t num_control_loop_overruns;
00025 ros::Time time_last_control_loop_overrun;
00026
00027 virtual int serialize(unsigned char *outbuffer) const
00028 {
00029 int offset = 0;
00030 uint32_t length_name = strlen(this->name);
00031 memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00032 offset += 4;
00033 memcpy(outbuffer + offset, this->name, length_name);
00034 offset += length_name;
00035 uint32_t length_type = strlen(this->type);
00036 memcpy(outbuffer + offset, &length_type, sizeof(uint32_t));
00037 offset += 4;
00038 memcpy(outbuffer + offset, this->type, length_type);
00039 offset += length_type;
00040 *(outbuffer + offset + 0) = (this->timestamp.sec >> (8 * 0)) & 0xFF;
00041 *(outbuffer + offset + 1) = (this->timestamp.sec >> (8 * 1)) & 0xFF;
00042 *(outbuffer + offset + 2) = (this->timestamp.sec >> (8 * 2)) & 0xFF;
00043 *(outbuffer + offset + 3) = (this->timestamp.sec >> (8 * 3)) & 0xFF;
00044 offset += sizeof(this->timestamp.sec);
00045 *(outbuffer + offset + 0) = (this->timestamp.nsec >> (8 * 0)) & 0xFF;
00046 *(outbuffer + offset + 1) = (this->timestamp.nsec >> (8 * 1)) & 0xFF;
00047 *(outbuffer + offset + 2) = (this->timestamp.nsec >> (8 * 2)) & 0xFF;
00048 *(outbuffer + offset + 3) = (this->timestamp.nsec >> (8 * 3)) & 0xFF;
00049 offset += sizeof(this->timestamp.nsec);
00050 union {
00051 bool real;
00052 uint8_t base;
00053 } u_running;
00054 u_running.real = this->running;
00055 *(outbuffer + offset + 0) = (u_running.base >> (8 * 0)) & 0xFF;
00056 offset += sizeof(this->running);
00057 *(outbuffer + offset + 0) = (this->max_time.sec >> (8 * 0)) & 0xFF;
00058 *(outbuffer + offset + 1) = (this->max_time.sec >> (8 * 1)) & 0xFF;
00059 *(outbuffer + offset + 2) = (this->max_time.sec >> (8 * 2)) & 0xFF;
00060 *(outbuffer + offset + 3) = (this->max_time.sec >> (8 * 3)) & 0xFF;
00061 offset += sizeof(this->max_time.sec);
00062 *(outbuffer + offset + 0) = (this->max_time.nsec >> (8 * 0)) & 0xFF;
00063 *(outbuffer + offset + 1) = (this->max_time.nsec >> (8 * 1)) & 0xFF;
00064 *(outbuffer + offset + 2) = (this->max_time.nsec >> (8 * 2)) & 0xFF;
00065 *(outbuffer + offset + 3) = (this->max_time.nsec >> (8 * 3)) & 0xFF;
00066 offset += sizeof(this->max_time.nsec);
00067 *(outbuffer + offset + 0) = (this->mean_time.sec >> (8 * 0)) & 0xFF;
00068 *(outbuffer + offset + 1) = (this->mean_time.sec >> (8 * 1)) & 0xFF;
00069 *(outbuffer + offset + 2) = (this->mean_time.sec >> (8 * 2)) & 0xFF;
00070 *(outbuffer + offset + 3) = (this->mean_time.sec >> (8 * 3)) & 0xFF;
00071 offset += sizeof(this->mean_time.sec);
00072 *(outbuffer + offset + 0) = (this->mean_time.nsec >> (8 * 0)) & 0xFF;
00073 *(outbuffer + offset + 1) = (this->mean_time.nsec >> (8 * 1)) & 0xFF;
00074 *(outbuffer + offset + 2) = (this->mean_time.nsec >> (8 * 2)) & 0xFF;
00075 *(outbuffer + offset + 3) = (this->mean_time.nsec >> (8 * 3)) & 0xFF;
00076 offset += sizeof(this->mean_time.nsec);
00077 *(outbuffer + offset + 0) = (this->variance_time.sec >> (8 * 0)) & 0xFF;
00078 *(outbuffer + offset + 1) = (this->variance_time.sec >> (8 * 1)) & 0xFF;
00079 *(outbuffer + offset + 2) = (this->variance_time.sec >> (8 * 2)) & 0xFF;
00080 *(outbuffer + offset + 3) = (this->variance_time.sec >> (8 * 3)) & 0xFF;
00081 offset += sizeof(this->variance_time.sec);
00082 *(outbuffer + offset + 0) = (this->variance_time.nsec >> (8 * 0)) & 0xFF;
00083 *(outbuffer + offset + 1) = (this->variance_time.nsec >> (8 * 1)) & 0xFF;
00084 *(outbuffer + offset + 2) = (this->variance_time.nsec >> (8 * 2)) & 0xFF;
00085 *(outbuffer + offset + 3) = (this->variance_time.nsec >> (8 * 3)) & 0xFF;
00086 offset += sizeof(this->variance_time.nsec);
00087 union {
00088 int32_t real;
00089 uint32_t base;
00090 } u_num_control_loop_overruns;
00091 u_num_control_loop_overruns.real = this->num_control_loop_overruns;
00092 *(outbuffer + offset + 0) = (u_num_control_loop_overruns.base >> (8 * 0)) & 0xFF;
00093 *(outbuffer + offset + 1) = (u_num_control_loop_overruns.base >> (8 * 1)) & 0xFF;
00094 *(outbuffer + offset + 2) = (u_num_control_loop_overruns.base >> (8 * 2)) & 0xFF;
00095 *(outbuffer + offset + 3) = (u_num_control_loop_overruns.base >> (8 * 3)) & 0xFF;
00096 offset += sizeof(this->num_control_loop_overruns);
00097 *(outbuffer + offset + 0) = (this->time_last_control_loop_overrun.sec >> (8 * 0)) & 0xFF;
00098 *(outbuffer + offset + 1) = (this->time_last_control_loop_overrun.sec >> (8 * 1)) & 0xFF;
00099 *(outbuffer + offset + 2) = (this->time_last_control_loop_overrun.sec >> (8 * 2)) & 0xFF;
00100 *(outbuffer + offset + 3) = (this->time_last_control_loop_overrun.sec >> (8 * 3)) & 0xFF;
00101 offset += sizeof(this->time_last_control_loop_overrun.sec);
00102 *(outbuffer + offset + 0) = (this->time_last_control_loop_overrun.nsec >> (8 * 0)) & 0xFF;
00103 *(outbuffer + offset + 1) = (this->time_last_control_loop_overrun.nsec >> (8 * 1)) & 0xFF;
00104 *(outbuffer + offset + 2) = (this->time_last_control_loop_overrun.nsec >> (8 * 2)) & 0xFF;
00105 *(outbuffer + offset + 3) = (this->time_last_control_loop_overrun.nsec >> (8 * 3)) & 0xFF;
00106 offset += sizeof(this->time_last_control_loop_overrun.nsec);
00107 return offset;
00108 }
00109
00110 virtual int deserialize(unsigned char *inbuffer)
00111 {
00112 int offset = 0;
00113 uint32_t length_name;
00114 memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00115 offset += 4;
00116 for(unsigned int k= offset; k< offset+length_name; ++k){
00117 inbuffer[k-1]=inbuffer[k];
00118 }
00119 inbuffer[offset+length_name-1]=0;
00120 this->name = (char *)(inbuffer + offset-1);
00121 offset += length_name;
00122 uint32_t length_type;
00123 memcpy(&length_type, (inbuffer + offset), sizeof(uint32_t));
00124 offset += 4;
00125 for(unsigned int k= offset; k< offset+length_type; ++k){
00126 inbuffer[k-1]=inbuffer[k];
00127 }
00128 inbuffer[offset+length_type-1]=0;
00129 this->type = (char *)(inbuffer + offset-1);
00130 offset += length_type;
00131 this->timestamp.sec = ((uint32_t) (*(inbuffer + offset)));
00132 this->timestamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00133 this->timestamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00134 this->timestamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00135 offset += sizeof(this->timestamp.sec);
00136 this->timestamp.nsec = ((uint32_t) (*(inbuffer + offset)));
00137 this->timestamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00138 this->timestamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00139 this->timestamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00140 offset += sizeof(this->timestamp.nsec);
00141 union {
00142 bool real;
00143 uint8_t base;
00144 } u_running;
00145 u_running.base = 0;
00146 u_running.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00147 this->running = u_running.real;
00148 offset += sizeof(this->running);
00149 this->max_time.sec = ((uint32_t) (*(inbuffer + offset)));
00150 this->max_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00151 this->max_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00152 this->max_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00153 offset += sizeof(this->max_time.sec);
00154 this->max_time.nsec = ((uint32_t) (*(inbuffer + offset)));
00155 this->max_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00156 this->max_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00157 this->max_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00158 offset += sizeof(this->max_time.nsec);
00159 this->mean_time.sec = ((uint32_t) (*(inbuffer + offset)));
00160 this->mean_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00161 this->mean_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00162 this->mean_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00163 offset += sizeof(this->mean_time.sec);
00164 this->mean_time.nsec = ((uint32_t) (*(inbuffer + offset)));
00165 this->mean_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00166 this->mean_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00167 this->mean_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00168 offset += sizeof(this->mean_time.nsec);
00169 this->variance_time.sec = ((uint32_t) (*(inbuffer + offset)));
00170 this->variance_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00171 this->variance_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00172 this->variance_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00173 offset += sizeof(this->variance_time.sec);
00174 this->variance_time.nsec = ((uint32_t) (*(inbuffer + offset)));
00175 this->variance_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00176 this->variance_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00177 this->variance_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00178 offset += sizeof(this->variance_time.nsec);
00179 union {
00180 int32_t real;
00181 uint32_t base;
00182 } u_num_control_loop_overruns;
00183 u_num_control_loop_overruns.base = 0;
00184 u_num_control_loop_overruns.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00185 u_num_control_loop_overruns.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00186 u_num_control_loop_overruns.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00187 u_num_control_loop_overruns.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00188 this->num_control_loop_overruns = u_num_control_loop_overruns.real;
00189 offset += sizeof(this->num_control_loop_overruns);
00190 this->time_last_control_loop_overrun.sec = ((uint32_t) (*(inbuffer + offset)));
00191 this->time_last_control_loop_overrun.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00192 this->time_last_control_loop_overrun.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00193 this->time_last_control_loop_overrun.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00194 offset += sizeof(this->time_last_control_loop_overrun.sec);
00195 this->time_last_control_loop_overrun.nsec = ((uint32_t) (*(inbuffer + offset)));
00196 this->time_last_control_loop_overrun.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00197 this->time_last_control_loop_overrun.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00198 this->time_last_control_loop_overrun.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00199 offset += sizeof(this->time_last_control_loop_overrun.nsec);
00200 return offset;
00201 }
00202
00203 const char * getType(){ return "controller_manager_msgs/ControllerStatistics"; };
00204 const char * getMD5(){ return "697780c372c8d8597a1436d0e2ad3ba8"; };
00205
00206 };
00207
00208 }
00209 #endif