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


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:55