MultiDOFJointState.h
Go to the documentation of this file.
00001 #ifndef _ROS_sensor_msgs_MultiDOFJointState_h
00002 #define _ROS_sensor_msgs_MultiDOFJointState_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "geometry_msgs/Transform.h"
00010 #include "geometry_msgs/Twist.h"
00011 #include "geometry_msgs/Wrench.h"
00012 
00013 namespace sensor_msgs
00014 {
00015 
00016   class MultiDOFJointState : public ros::Msg
00017   {
00018     public:
00019       std_msgs::Header header;
00020       uint8_t joint_names_length;
00021       char* st_joint_names;
00022       char* * joint_names;
00023       uint8_t transforms_length;
00024       geometry_msgs::Transform st_transforms;
00025       geometry_msgs::Transform * transforms;
00026       uint8_t twist_length;
00027       geometry_msgs::Twist st_twist;
00028       geometry_msgs::Twist * twist;
00029       uint8_t wrench_length;
00030       geometry_msgs::Wrench st_wrench;
00031       geometry_msgs::Wrench * wrench;
00032 
00033     virtual int serialize(unsigned char *outbuffer) const
00034     {
00035       int offset = 0;
00036       offset += this->header.serialize(outbuffer + offset);
00037       *(outbuffer + offset++) = joint_names_length;
00038       *(outbuffer + offset++) = 0;
00039       *(outbuffer + offset++) = 0;
00040       *(outbuffer + offset++) = 0;
00041       for( uint8_t i = 0; i < joint_names_length; i++){
00042       uint32_t length_joint_namesi = strlen(this->joint_names[i]);
00043       memcpy(outbuffer + offset, &length_joint_namesi, sizeof(uint32_t));
00044       offset += 4;
00045       memcpy(outbuffer + offset, this->joint_names[i], length_joint_namesi);
00046       offset += length_joint_namesi;
00047       }
00048       *(outbuffer + offset++) = transforms_length;
00049       *(outbuffer + offset++) = 0;
00050       *(outbuffer + offset++) = 0;
00051       *(outbuffer + offset++) = 0;
00052       for( uint8_t i = 0; i < transforms_length; i++){
00053       offset += this->transforms[i].serialize(outbuffer + offset);
00054       }
00055       *(outbuffer + offset++) = twist_length;
00056       *(outbuffer + offset++) = 0;
00057       *(outbuffer + offset++) = 0;
00058       *(outbuffer + offset++) = 0;
00059       for( uint8_t i = 0; i < twist_length; i++){
00060       offset += this->twist[i].serialize(outbuffer + offset);
00061       }
00062       *(outbuffer + offset++) = wrench_length;
00063       *(outbuffer + offset++) = 0;
00064       *(outbuffer + offset++) = 0;
00065       *(outbuffer + offset++) = 0;
00066       for( uint8_t i = 0; i < wrench_length; i++){
00067       offset += this->wrench[i].serialize(outbuffer + offset);
00068       }
00069       return offset;
00070     }
00071 
00072     virtual int deserialize(unsigned char *inbuffer)
00073     {
00074       int offset = 0;
00075       offset += this->header.deserialize(inbuffer + offset);
00076       uint8_t joint_names_lengthT = *(inbuffer + offset++);
00077       if(joint_names_lengthT > joint_names_length)
00078         this->joint_names = (char**)realloc(this->joint_names, joint_names_lengthT * sizeof(char*));
00079       offset += 3;
00080       joint_names_length = joint_names_lengthT;
00081       for( uint8_t i = 0; i < joint_names_length; i++){
00082       uint32_t length_st_joint_names;
00083       memcpy(&length_st_joint_names, (inbuffer + offset), sizeof(uint32_t));
00084       offset += 4;
00085       for(unsigned int k= offset; k< offset+length_st_joint_names; ++k){
00086           inbuffer[k-1]=inbuffer[k];
00087       }
00088       inbuffer[offset+length_st_joint_names-1]=0;
00089       this->st_joint_names = (char *)(inbuffer + offset-1);
00090       offset += length_st_joint_names;
00091         memcpy( &(this->joint_names[i]), &(this->st_joint_names), sizeof(char*));
00092       }
00093       uint8_t transforms_lengthT = *(inbuffer + offset++);
00094       if(transforms_lengthT > transforms_length)
00095         this->transforms = (geometry_msgs::Transform*)realloc(this->transforms, transforms_lengthT * sizeof(geometry_msgs::Transform));
00096       offset += 3;
00097       transforms_length = transforms_lengthT;
00098       for( uint8_t i = 0; i < transforms_length; i++){
00099       offset += this->st_transforms.deserialize(inbuffer + offset);
00100         memcpy( &(this->transforms[i]), &(this->st_transforms), sizeof(geometry_msgs::Transform));
00101       }
00102       uint8_t twist_lengthT = *(inbuffer + offset++);
00103       if(twist_lengthT > twist_length)
00104         this->twist = (geometry_msgs::Twist*)realloc(this->twist, twist_lengthT * sizeof(geometry_msgs::Twist));
00105       offset += 3;
00106       twist_length = twist_lengthT;
00107       for( uint8_t i = 0; i < twist_length; i++){
00108       offset += this->st_twist.deserialize(inbuffer + offset);
00109         memcpy( &(this->twist[i]), &(this->st_twist), sizeof(geometry_msgs::Twist));
00110       }
00111       uint8_t wrench_lengthT = *(inbuffer + offset++);
00112       if(wrench_lengthT > wrench_length)
00113         this->wrench = (geometry_msgs::Wrench*)realloc(this->wrench, wrench_lengthT * sizeof(geometry_msgs::Wrench));
00114       offset += 3;
00115       wrench_length = wrench_lengthT;
00116       for( uint8_t i = 0; i < wrench_length; i++){
00117       offset += this->st_wrench.deserialize(inbuffer + offset);
00118         memcpy( &(this->wrench[i]), &(this->st_wrench), sizeof(geometry_msgs::Wrench));
00119       }
00120      return offset;
00121     }
00122 
00123     const char * getType(){ return "sensor_msgs/MultiDOFJointState"; };
00124     const char * getMD5(){ return "690f272f0640d2631c305eeb8301e59d"; };
00125 
00126   };
00127 
00128 }
00129 #endif


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