Go to the documentation of this file.00001 #ifndef _ROS_gazebo_msgs_WorldState_h
00002 #define _ROS_gazebo_msgs_WorldState_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/Pose.h"
00010 #include "geometry_msgs/Twist.h"
00011 #include "geometry_msgs/Wrench.h"
00012
00013 namespace gazebo_msgs
00014 {
00015
00016 class WorldState : public ros::Msg
00017 {
00018 public:
00019 std_msgs::Header header;
00020 uint8_t name_length;
00021 char* st_name;
00022 char* * name;
00023 uint8_t pose_length;
00024 geometry_msgs::Pose st_pose;
00025 geometry_msgs::Pose * pose;
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++) = name_length;
00038 *(outbuffer + offset++) = 0;
00039 *(outbuffer + offset++) = 0;
00040 *(outbuffer + offset++) = 0;
00041 for( uint8_t i = 0; i < name_length; i++){
00042 uint32_t length_namei = strlen(this->name[i]);
00043 memcpy(outbuffer + offset, &length_namei, sizeof(uint32_t));
00044 offset += 4;
00045 memcpy(outbuffer + offset, this->name[i], length_namei);
00046 offset += length_namei;
00047 }
00048 *(outbuffer + offset++) = pose_length;
00049 *(outbuffer + offset++) = 0;
00050 *(outbuffer + offset++) = 0;
00051 *(outbuffer + offset++) = 0;
00052 for( uint8_t i = 0; i < pose_length; i++){
00053 offset += this->pose[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 name_lengthT = *(inbuffer + offset++);
00077 if(name_lengthT > name_length)
00078 this->name = (char**)realloc(this->name, name_lengthT * sizeof(char*));
00079 offset += 3;
00080 name_length = name_lengthT;
00081 for( uint8_t i = 0; i < name_length; i++){
00082 uint32_t length_st_name;
00083 memcpy(&length_st_name, (inbuffer + offset), sizeof(uint32_t));
00084 offset += 4;
00085 for(unsigned int k= offset; k< offset+length_st_name; ++k){
00086 inbuffer[k-1]=inbuffer[k];
00087 }
00088 inbuffer[offset+length_st_name-1]=0;
00089 this->st_name = (char *)(inbuffer + offset-1);
00090 offset += length_st_name;
00091 memcpy( &(this->name[i]), &(this->st_name), sizeof(char*));
00092 }
00093 uint8_t pose_lengthT = *(inbuffer + offset++);
00094 if(pose_lengthT > pose_length)
00095 this->pose = (geometry_msgs::Pose*)realloc(this->pose, pose_lengthT * sizeof(geometry_msgs::Pose));
00096 offset += 3;
00097 pose_length = pose_lengthT;
00098 for( uint8_t i = 0; i < pose_length; i++){
00099 offset += this->st_pose.deserialize(inbuffer + offset);
00100 memcpy( &(this->pose[i]), &(this->st_pose), sizeof(geometry_msgs::Pose));
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 "gazebo_msgs/WorldState"; };
00124 const char * getMD5(){ return "de1a9de3ab7ba97ac0e9ec01a4eb481e"; };
00125
00126 };
00127
00128 }
00129 #endif