Go to the documentation of this file.00001 #ifndef _ROS_gazebo_msgs_ModelState_h
00002 #define _ROS_gazebo_msgs_ModelState_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "geometry_msgs/Pose.h"
00009 #include "geometry_msgs/Twist.h"
00010
00011 namespace gazebo_msgs
00012 {
00013
00014 class ModelState : public ros::Msg
00015 {
00016 public:
00017 const char* model_name;
00018 geometry_msgs::Pose pose;
00019 geometry_msgs::Twist twist;
00020 const char* reference_frame;
00021
00022 virtual int serialize(unsigned char *outbuffer) const
00023 {
00024 int offset = 0;
00025 uint32_t length_model_name = strlen(this->model_name);
00026 memcpy(outbuffer + offset, &length_model_name, sizeof(uint32_t));
00027 offset += 4;
00028 memcpy(outbuffer + offset, this->model_name, length_model_name);
00029 offset += length_model_name;
00030 offset += this->pose.serialize(outbuffer + offset);
00031 offset += this->twist.serialize(outbuffer + offset);
00032 uint32_t length_reference_frame = strlen(this->reference_frame);
00033 memcpy(outbuffer + offset, &length_reference_frame, sizeof(uint32_t));
00034 offset += 4;
00035 memcpy(outbuffer + offset, this->reference_frame, length_reference_frame);
00036 offset += length_reference_frame;
00037 return offset;
00038 }
00039
00040 virtual int deserialize(unsigned char *inbuffer)
00041 {
00042 int offset = 0;
00043 uint32_t length_model_name;
00044 memcpy(&length_model_name, (inbuffer + offset), sizeof(uint32_t));
00045 offset += 4;
00046 for(unsigned int k= offset; k< offset+length_model_name; ++k){
00047 inbuffer[k-1]=inbuffer[k];
00048 }
00049 inbuffer[offset+length_model_name-1]=0;
00050 this->model_name = (char *)(inbuffer + offset-1);
00051 offset += length_model_name;
00052 offset += this->pose.deserialize(inbuffer + offset);
00053 offset += this->twist.deserialize(inbuffer + offset);
00054 uint32_t length_reference_frame;
00055 memcpy(&length_reference_frame, (inbuffer + offset), sizeof(uint32_t));
00056 offset += 4;
00057 for(unsigned int k= offset; k< offset+length_reference_frame; ++k){
00058 inbuffer[k-1]=inbuffer[k];
00059 }
00060 inbuffer[offset+length_reference_frame-1]=0;
00061 this->reference_frame = (char *)(inbuffer + offset-1);
00062 offset += length_reference_frame;
00063 return offset;
00064 }
00065
00066 const char * getType(){ return "gazebo_msgs/ModelState"; };
00067 const char * getMD5(){ return "9330fd35f2fcd82d457e54bd54e10593"; };
00068
00069 };
00070
00071 }
00072 #endif