Go to the documentation of this file.00001 #ifndef _ROS_rosabridge_msgs_Odometry_h
00002 #define _ROS_rosabridge_msgs_Odometry_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 "rosabridge_msgs/Pose.h"
00010 #include "rosabridge_msgs/Twist.h"
00011
00012 namespace rosabridge_msgs
00013 {
00014
00015 class Odometry : public ros::Msg
00016 {
00017 public:
00018 std_msgs::Header header;
00019 const char* child_frame_id;
00020 rosabridge_msgs::Pose pose;
00021 float pose_covariance[6];
00022 rosabridge_msgs::Twist twist;
00023 float twist_covariance[6];
00024
00025 virtual int serialize(unsigned char *outbuffer) const
00026 {
00027 int offset = 0;
00028 offset += this->header.serialize(outbuffer + offset);
00029 uint32_t length_child_frame_id = strlen(this->child_frame_id);
00030 memcpy(outbuffer + offset, &length_child_frame_id, sizeof(uint32_t));
00031 offset += 4;
00032 memcpy(outbuffer + offset, this->child_frame_id, length_child_frame_id);
00033 offset += length_child_frame_id;
00034 offset += this->pose.serialize(outbuffer + offset);
00035 for( uint8_t i = 0; i < 6; i++){
00036 union {
00037 float real;
00038 uint32_t base;
00039 } u_pose_covariancei;
00040 u_pose_covariancei.real = this->pose_covariance[i];
00041 *(outbuffer + offset + 0) = (u_pose_covariancei.base >> (8 * 0)) & 0xFF;
00042 *(outbuffer + offset + 1) = (u_pose_covariancei.base >> (8 * 1)) & 0xFF;
00043 *(outbuffer + offset + 2) = (u_pose_covariancei.base >> (8 * 2)) & 0xFF;
00044 *(outbuffer + offset + 3) = (u_pose_covariancei.base >> (8 * 3)) & 0xFF;
00045 offset += sizeof(this->pose_covariance[i]);
00046 }
00047 offset += this->twist.serialize(outbuffer + offset);
00048 for( uint8_t i = 0; i < 6; i++){
00049 union {
00050 float real;
00051 uint32_t base;
00052 } u_twist_covariancei;
00053 u_twist_covariancei.real = this->twist_covariance[i];
00054 *(outbuffer + offset + 0) = (u_twist_covariancei.base >> (8 * 0)) & 0xFF;
00055 *(outbuffer + offset + 1) = (u_twist_covariancei.base >> (8 * 1)) & 0xFF;
00056 *(outbuffer + offset + 2) = (u_twist_covariancei.base >> (8 * 2)) & 0xFF;
00057 *(outbuffer + offset + 3) = (u_twist_covariancei.base >> (8 * 3)) & 0xFF;
00058 offset += sizeof(this->twist_covariance[i]);
00059 }
00060 return offset;
00061 }
00062
00063 virtual int deserialize(unsigned char *inbuffer)
00064 {
00065 int offset = 0;
00066 offset += this->header.deserialize(inbuffer + offset);
00067 uint32_t length_child_frame_id;
00068 memcpy(&length_child_frame_id, (inbuffer + offset), sizeof(uint32_t));
00069 offset += 4;
00070 for(unsigned int k= offset; k< offset+length_child_frame_id; ++k){
00071 inbuffer[k-1]=inbuffer[k];
00072 }
00073 inbuffer[offset+length_child_frame_id-1]=0;
00074 this->child_frame_id = (char *)(inbuffer + offset-1);
00075 offset += length_child_frame_id;
00076 offset += this->pose.deserialize(inbuffer + offset);
00077 for( uint8_t i = 0; i < 6; i++){
00078 union {
00079 float real;
00080 uint32_t base;
00081 } u_pose_covariancei;
00082 u_pose_covariancei.base = 0;
00083 u_pose_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00084 u_pose_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00085 u_pose_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00086 u_pose_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00087 this->pose_covariance[i] = u_pose_covariancei.real;
00088 offset += sizeof(this->pose_covariance[i]);
00089 }
00090 offset += this->twist.deserialize(inbuffer + offset);
00091 for( uint8_t i = 0; i < 6; i++){
00092 union {
00093 float real;
00094 uint32_t base;
00095 } u_twist_covariancei;
00096 u_twist_covariancei.base = 0;
00097 u_twist_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00098 u_twist_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00099 u_twist_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00100 u_twist_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00101 this->twist_covariance[i] = u_twist_covariancei.real;
00102 offset += sizeof(this->twist_covariance[i]);
00103 }
00104 return offset;
00105 }
00106
00107 const char * getType(){ return "rosabridge_msgs/Odometry"; };
00108 const char * getMD5(){ return "3c88d21ba93f27fc21da1718473d3e4e"; };
00109
00110 };
00111
00112 }
00113 #endif