JointStatistics.h
Go to the documentation of this file.
00001 #ifndef _ROS_pr2_mechanism_msgs_JointStatistics_h
00002 #define _ROS_pr2_mechanism_msgs_JointStatistics_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 
00010 namespace pr2_mechanism_msgs
00011 {
00012 
00013   class JointStatistics : public ros::Msg
00014   {
00015     public:
00016       const char* name;
00017       ros::Time timestamp;
00018       float position;
00019       float velocity;
00020       float measured_effort;
00021       float commanded_effort;
00022       bool is_calibrated;
00023       bool violated_limits;
00024       float odometer;
00025       float min_position;
00026       float max_position;
00027       float max_abs_velocity;
00028       float max_abs_effort;
00029 
00030     virtual int serialize(unsigned char *outbuffer) const
00031     {
00032       int offset = 0;
00033       uint32_t length_name = strlen(this->name);
00034       memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00035       offset += 4;
00036       memcpy(outbuffer + offset, this->name, length_name);
00037       offset += length_name;
00038       *(outbuffer + offset + 0) = (this->timestamp.sec >> (8 * 0)) & 0xFF;
00039       *(outbuffer + offset + 1) = (this->timestamp.sec >> (8 * 1)) & 0xFF;
00040       *(outbuffer + offset + 2) = (this->timestamp.sec >> (8 * 2)) & 0xFF;
00041       *(outbuffer + offset + 3) = (this->timestamp.sec >> (8 * 3)) & 0xFF;
00042       offset += sizeof(this->timestamp.sec);
00043       *(outbuffer + offset + 0) = (this->timestamp.nsec >> (8 * 0)) & 0xFF;
00044       *(outbuffer + offset + 1) = (this->timestamp.nsec >> (8 * 1)) & 0xFF;
00045       *(outbuffer + offset + 2) = (this->timestamp.nsec >> (8 * 2)) & 0xFF;
00046       *(outbuffer + offset + 3) = (this->timestamp.nsec >> (8 * 3)) & 0xFF;
00047       offset += sizeof(this->timestamp.nsec);
00048       int32_t * val_position = (int32_t *) &(this->position);
00049       int32_t exp_position = (((*val_position)>>23)&255);
00050       if(exp_position != 0)
00051         exp_position += 1023-127;
00052       int32_t sig_position = *val_position;
00053       *(outbuffer + offset++) = 0;
00054       *(outbuffer + offset++) = 0;
00055       *(outbuffer + offset++) = 0;
00056       *(outbuffer + offset++) = (sig_position<<5) & 0xff;
00057       *(outbuffer + offset++) = (sig_position>>3) & 0xff;
00058       *(outbuffer + offset++) = (sig_position>>11) & 0xff;
00059       *(outbuffer + offset++) = ((exp_position<<4) & 0xF0) | ((sig_position>>19)&0x0F);
00060       *(outbuffer + offset++) = (exp_position>>4) & 0x7F;
00061       if(this->position < 0) *(outbuffer + offset -1) |= 0x80;
00062       int32_t * val_velocity = (int32_t *) &(this->velocity);
00063       int32_t exp_velocity = (((*val_velocity)>>23)&255);
00064       if(exp_velocity != 0)
00065         exp_velocity += 1023-127;
00066       int32_t sig_velocity = *val_velocity;
00067       *(outbuffer + offset++) = 0;
00068       *(outbuffer + offset++) = 0;
00069       *(outbuffer + offset++) = 0;
00070       *(outbuffer + offset++) = (sig_velocity<<5) & 0xff;
00071       *(outbuffer + offset++) = (sig_velocity>>3) & 0xff;
00072       *(outbuffer + offset++) = (sig_velocity>>11) & 0xff;
00073       *(outbuffer + offset++) = ((exp_velocity<<4) & 0xF0) | ((sig_velocity>>19)&0x0F);
00074       *(outbuffer + offset++) = (exp_velocity>>4) & 0x7F;
00075       if(this->velocity < 0) *(outbuffer + offset -1) |= 0x80;
00076       int32_t * val_measured_effort = (int32_t *) &(this->measured_effort);
00077       int32_t exp_measured_effort = (((*val_measured_effort)>>23)&255);
00078       if(exp_measured_effort != 0)
00079         exp_measured_effort += 1023-127;
00080       int32_t sig_measured_effort = *val_measured_effort;
00081       *(outbuffer + offset++) = 0;
00082       *(outbuffer + offset++) = 0;
00083       *(outbuffer + offset++) = 0;
00084       *(outbuffer + offset++) = (sig_measured_effort<<5) & 0xff;
00085       *(outbuffer + offset++) = (sig_measured_effort>>3) & 0xff;
00086       *(outbuffer + offset++) = (sig_measured_effort>>11) & 0xff;
00087       *(outbuffer + offset++) = ((exp_measured_effort<<4) & 0xF0) | ((sig_measured_effort>>19)&0x0F);
00088       *(outbuffer + offset++) = (exp_measured_effort>>4) & 0x7F;
00089       if(this->measured_effort < 0) *(outbuffer + offset -1) |= 0x80;
00090       int32_t * val_commanded_effort = (int32_t *) &(this->commanded_effort);
00091       int32_t exp_commanded_effort = (((*val_commanded_effort)>>23)&255);
00092       if(exp_commanded_effort != 0)
00093         exp_commanded_effort += 1023-127;
00094       int32_t sig_commanded_effort = *val_commanded_effort;
00095       *(outbuffer + offset++) = 0;
00096       *(outbuffer + offset++) = 0;
00097       *(outbuffer + offset++) = 0;
00098       *(outbuffer + offset++) = (sig_commanded_effort<<5) & 0xff;
00099       *(outbuffer + offset++) = (sig_commanded_effort>>3) & 0xff;
00100       *(outbuffer + offset++) = (sig_commanded_effort>>11) & 0xff;
00101       *(outbuffer + offset++) = ((exp_commanded_effort<<4) & 0xF0) | ((sig_commanded_effort>>19)&0x0F);
00102       *(outbuffer + offset++) = (exp_commanded_effort>>4) & 0x7F;
00103       if(this->commanded_effort < 0) *(outbuffer + offset -1) |= 0x80;
00104       union {
00105         bool real;
00106         uint8_t base;
00107       } u_is_calibrated;
00108       u_is_calibrated.real = this->is_calibrated;
00109       *(outbuffer + offset + 0) = (u_is_calibrated.base >> (8 * 0)) & 0xFF;
00110       offset += sizeof(this->is_calibrated);
00111       union {
00112         bool real;
00113         uint8_t base;
00114       } u_violated_limits;
00115       u_violated_limits.real = this->violated_limits;
00116       *(outbuffer + offset + 0) = (u_violated_limits.base >> (8 * 0)) & 0xFF;
00117       offset += sizeof(this->violated_limits);
00118       int32_t * val_odometer = (int32_t *) &(this->odometer);
00119       int32_t exp_odometer = (((*val_odometer)>>23)&255);
00120       if(exp_odometer != 0)
00121         exp_odometer += 1023-127;
00122       int32_t sig_odometer = *val_odometer;
00123       *(outbuffer + offset++) = 0;
00124       *(outbuffer + offset++) = 0;
00125       *(outbuffer + offset++) = 0;
00126       *(outbuffer + offset++) = (sig_odometer<<5) & 0xff;
00127       *(outbuffer + offset++) = (sig_odometer>>3) & 0xff;
00128       *(outbuffer + offset++) = (sig_odometer>>11) & 0xff;
00129       *(outbuffer + offset++) = ((exp_odometer<<4) & 0xF0) | ((sig_odometer>>19)&0x0F);
00130       *(outbuffer + offset++) = (exp_odometer>>4) & 0x7F;
00131       if(this->odometer < 0) *(outbuffer + offset -1) |= 0x80;
00132       int32_t * val_min_position = (int32_t *) &(this->min_position);
00133       int32_t exp_min_position = (((*val_min_position)>>23)&255);
00134       if(exp_min_position != 0)
00135         exp_min_position += 1023-127;
00136       int32_t sig_min_position = *val_min_position;
00137       *(outbuffer + offset++) = 0;
00138       *(outbuffer + offset++) = 0;
00139       *(outbuffer + offset++) = 0;
00140       *(outbuffer + offset++) = (sig_min_position<<5) & 0xff;
00141       *(outbuffer + offset++) = (sig_min_position>>3) & 0xff;
00142       *(outbuffer + offset++) = (sig_min_position>>11) & 0xff;
00143       *(outbuffer + offset++) = ((exp_min_position<<4) & 0xF0) | ((sig_min_position>>19)&0x0F);
00144       *(outbuffer + offset++) = (exp_min_position>>4) & 0x7F;
00145       if(this->min_position < 0) *(outbuffer + offset -1) |= 0x80;
00146       int32_t * val_max_position = (int32_t *) &(this->max_position);
00147       int32_t exp_max_position = (((*val_max_position)>>23)&255);
00148       if(exp_max_position != 0)
00149         exp_max_position += 1023-127;
00150       int32_t sig_max_position = *val_max_position;
00151       *(outbuffer + offset++) = 0;
00152       *(outbuffer + offset++) = 0;
00153       *(outbuffer + offset++) = 0;
00154       *(outbuffer + offset++) = (sig_max_position<<5) & 0xff;
00155       *(outbuffer + offset++) = (sig_max_position>>3) & 0xff;
00156       *(outbuffer + offset++) = (sig_max_position>>11) & 0xff;
00157       *(outbuffer + offset++) = ((exp_max_position<<4) & 0xF0) | ((sig_max_position>>19)&0x0F);
00158       *(outbuffer + offset++) = (exp_max_position>>4) & 0x7F;
00159       if(this->max_position < 0) *(outbuffer + offset -1) |= 0x80;
00160       int32_t * val_max_abs_velocity = (int32_t *) &(this->max_abs_velocity);
00161       int32_t exp_max_abs_velocity = (((*val_max_abs_velocity)>>23)&255);
00162       if(exp_max_abs_velocity != 0)
00163         exp_max_abs_velocity += 1023-127;
00164       int32_t sig_max_abs_velocity = *val_max_abs_velocity;
00165       *(outbuffer + offset++) = 0;
00166       *(outbuffer + offset++) = 0;
00167       *(outbuffer + offset++) = 0;
00168       *(outbuffer + offset++) = (sig_max_abs_velocity<<5) & 0xff;
00169       *(outbuffer + offset++) = (sig_max_abs_velocity>>3) & 0xff;
00170       *(outbuffer + offset++) = (sig_max_abs_velocity>>11) & 0xff;
00171       *(outbuffer + offset++) = ((exp_max_abs_velocity<<4) & 0xF0) | ((sig_max_abs_velocity>>19)&0x0F);
00172       *(outbuffer + offset++) = (exp_max_abs_velocity>>4) & 0x7F;
00173       if(this->max_abs_velocity < 0) *(outbuffer + offset -1) |= 0x80;
00174       int32_t * val_max_abs_effort = (int32_t *) &(this->max_abs_effort);
00175       int32_t exp_max_abs_effort = (((*val_max_abs_effort)>>23)&255);
00176       if(exp_max_abs_effort != 0)
00177         exp_max_abs_effort += 1023-127;
00178       int32_t sig_max_abs_effort = *val_max_abs_effort;
00179       *(outbuffer + offset++) = 0;
00180       *(outbuffer + offset++) = 0;
00181       *(outbuffer + offset++) = 0;
00182       *(outbuffer + offset++) = (sig_max_abs_effort<<5) & 0xff;
00183       *(outbuffer + offset++) = (sig_max_abs_effort>>3) & 0xff;
00184       *(outbuffer + offset++) = (sig_max_abs_effort>>11) & 0xff;
00185       *(outbuffer + offset++) = ((exp_max_abs_effort<<4) & 0xF0) | ((sig_max_abs_effort>>19)&0x0F);
00186       *(outbuffer + offset++) = (exp_max_abs_effort>>4) & 0x7F;
00187       if(this->max_abs_effort < 0) *(outbuffer + offset -1) |= 0x80;
00188       return offset;
00189     }
00190 
00191     virtual int deserialize(unsigned char *inbuffer)
00192     {
00193       int offset = 0;
00194       uint32_t length_name;
00195       memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00196       offset += 4;
00197       for(unsigned int k= offset; k< offset+length_name; ++k){
00198           inbuffer[k-1]=inbuffer[k];
00199       }
00200       inbuffer[offset+length_name-1]=0;
00201       this->name = (char *)(inbuffer + offset-1);
00202       offset += length_name;
00203       this->timestamp.sec =  ((uint32_t) (*(inbuffer + offset)));
00204       this->timestamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00205       this->timestamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00206       this->timestamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00207       offset += sizeof(this->timestamp.sec);
00208       this->timestamp.nsec =  ((uint32_t) (*(inbuffer + offset)));
00209       this->timestamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00210       this->timestamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00211       this->timestamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00212       offset += sizeof(this->timestamp.nsec);
00213       uint32_t * val_position = (uint32_t*) &(this->position);
00214       offset += 3;
00215       *val_position = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00216       *val_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00217       *val_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00218       *val_position |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00219       uint32_t exp_position = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00220       exp_position |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00221       if(exp_position !=0)
00222         *val_position |= ((exp_position)-1023+127)<<23;
00223       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->position = -this->position;
00224       uint32_t * val_velocity = (uint32_t*) &(this->velocity);
00225       offset += 3;
00226       *val_velocity = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00227       *val_velocity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00228       *val_velocity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00229       *val_velocity |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00230       uint32_t exp_velocity = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00231       exp_velocity |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00232       if(exp_velocity !=0)
00233         *val_velocity |= ((exp_velocity)-1023+127)<<23;
00234       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->velocity = -this->velocity;
00235       uint32_t * val_measured_effort = (uint32_t*) &(this->measured_effort);
00236       offset += 3;
00237       *val_measured_effort = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00238       *val_measured_effort |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00239       *val_measured_effort |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00240       *val_measured_effort |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00241       uint32_t exp_measured_effort = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00242       exp_measured_effort |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00243       if(exp_measured_effort !=0)
00244         *val_measured_effort |= ((exp_measured_effort)-1023+127)<<23;
00245       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->measured_effort = -this->measured_effort;
00246       uint32_t * val_commanded_effort = (uint32_t*) &(this->commanded_effort);
00247       offset += 3;
00248       *val_commanded_effort = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00249       *val_commanded_effort |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00250       *val_commanded_effort |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00251       *val_commanded_effort |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00252       uint32_t exp_commanded_effort = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00253       exp_commanded_effort |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00254       if(exp_commanded_effort !=0)
00255         *val_commanded_effort |= ((exp_commanded_effort)-1023+127)<<23;
00256       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->commanded_effort = -this->commanded_effort;
00257       union {
00258         bool real;
00259         uint8_t base;
00260       } u_is_calibrated;
00261       u_is_calibrated.base = 0;
00262       u_is_calibrated.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00263       this->is_calibrated = u_is_calibrated.real;
00264       offset += sizeof(this->is_calibrated);
00265       union {
00266         bool real;
00267         uint8_t base;
00268       } u_violated_limits;
00269       u_violated_limits.base = 0;
00270       u_violated_limits.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00271       this->violated_limits = u_violated_limits.real;
00272       offset += sizeof(this->violated_limits);
00273       uint32_t * val_odometer = (uint32_t*) &(this->odometer);
00274       offset += 3;
00275       *val_odometer = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00276       *val_odometer |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00277       *val_odometer |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00278       *val_odometer |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00279       uint32_t exp_odometer = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00280       exp_odometer |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00281       if(exp_odometer !=0)
00282         *val_odometer |= ((exp_odometer)-1023+127)<<23;
00283       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->odometer = -this->odometer;
00284       uint32_t * val_min_position = (uint32_t*) &(this->min_position);
00285       offset += 3;
00286       *val_min_position = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00287       *val_min_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00288       *val_min_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00289       *val_min_position |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00290       uint32_t exp_min_position = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00291       exp_min_position |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00292       if(exp_min_position !=0)
00293         *val_min_position |= ((exp_min_position)-1023+127)<<23;
00294       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->min_position = -this->min_position;
00295       uint32_t * val_max_position = (uint32_t*) &(this->max_position);
00296       offset += 3;
00297       *val_max_position = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00298       *val_max_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00299       *val_max_position |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00300       *val_max_position |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00301       uint32_t exp_max_position = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00302       exp_max_position |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00303       if(exp_max_position !=0)
00304         *val_max_position |= ((exp_max_position)-1023+127)<<23;
00305       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->max_position = -this->max_position;
00306       uint32_t * val_max_abs_velocity = (uint32_t*) &(this->max_abs_velocity);
00307       offset += 3;
00308       *val_max_abs_velocity = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00309       *val_max_abs_velocity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00310       *val_max_abs_velocity |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00311       *val_max_abs_velocity |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00312       uint32_t exp_max_abs_velocity = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00313       exp_max_abs_velocity |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00314       if(exp_max_abs_velocity !=0)
00315         *val_max_abs_velocity |= ((exp_max_abs_velocity)-1023+127)<<23;
00316       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->max_abs_velocity = -this->max_abs_velocity;
00317       uint32_t * val_max_abs_effort = (uint32_t*) &(this->max_abs_effort);
00318       offset += 3;
00319       *val_max_abs_effort = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00320       *val_max_abs_effort |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00321       *val_max_abs_effort |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00322       *val_max_abs_effort |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00323       uint32_t exp_max_abs_effort = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00324       exp_max_abs_effort |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00325       if(exp_max_abs_effort !=0)
00326         *val_max_abs_effort |= ((exp_max_abs_effort)-1023+127)<<23;
00327       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->max_abs_effort = -this->max_abs_effort;
00328      return offset;
00329     }
00330 
00331     const char * getType(){ return "pr2_mechanism_msgs/JointStatistics"; };
00332     const char * getMD5(){ return "90fdc8acbce5bc783d8b4aec49af6590"; };
00333 
00334   };
00335 
00336 }
00337 #endif


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