Akash Vibhute / Mbed 2 deprecated rosserial_hydro

Dependencies:   MODSERIAL mbed

Dependents:   mbed_roshydro_test

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ProjectedMapInfo.h Source File

ProjectedMapInfo.h

00001 #ifndef _ROS_map_msgs_ProjectedMapInfo_h
00002 #define _ROS_map_msgs_ProjectedMapInfo_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace map_msgs
00010 {
00011 
00012   class ProjectedMapInfo : public ros::Msg
00013   {
00014     public:
00015       const char* frame_id;
00016       float x;
00017       float y;
00018       float width;
00019       float height;
00020       float min_z;
00021       float max_z;
00022 
00023     ProjectedMapInfo():
00024       frame_id(""),
00025       x(0),
00026       y(0),
00027       width(0),
00028       height(0),
00029       min_z(0),
00030       max_z(0)
00031     {
00032     }
00033 
00034     virtual int serialize(unsigned char *outbuffer) const
00035     {
00036       int offset = 0;
00037       uint32_t length_frame_id = strlen(this->frame_id);
00038       memcpy(outbuffer + offset, &length_frame_id, sizeof(uint32_t));
00039       offset += 4;
00040       memcpy(outbuffer + offset, this->frame_id, length_frame_id);
00041       offset += length_frame_id;
00042       offset += serializeAvrFloat64(outbuffer + offset, this->x);
00043       offset += serializeAvrFloat64(outbuffer + offset, this->y);
00044       offset += serializeAvrFloat64(outbuffer + offset, this->width);
00045       offset += serializeAvrFloat64(outbuffer + offset, this->height);
00046       offset += serializeAvrFloat64(outbuffer + offset, this->min_z);
00047       offset += serializeAvrFloat64(outbuffer + offset, this->max_z);
00048       return offset;
00049     }
00050 
00051     virtual int deserialize(unsigned char *inbuffer)
00052     {
00053       int offset = 0;
00054       uint32_t length_frame_id;
00055       memcpy(&length_frame_id, (inbuffer + offset), sizeof(uint32_t));
00056       offset += 4;
00057       for(unsigned int k= offset; k< offset+length_frame_id; ++k){
00058           inbuffer[k-1]=inbuffer[k];
00059       }
00060       inbuffer[offset+length_frame_id-1]=0;
00061       this->frame_id = (char *)(inbuffer + offset-1);
00062       offset += length_frame_id;
00063       offset += deserializeAvrFloat64(inbuffer + offset, &(this->x));
00064       offset += deserializeAvrFloat64(inbuffer + offset, &(this->y));
00065       offset += deserializeAvrFloat64(inbuffer + offset, &(this->width));
00066       offset += deserializeAvrFloat64(inbuffer + offset, &(this->height));
00067       offset += deserializeAvrFloat64(inbuffer + offset, &(this->min_z));
00068       offset += deserializeAvrFloat64(inbuffer + offset, &(this->max_z));
00069      return offset;
00070     }
00071 
00072     const char * getType(){ return "map_msgs/ProjectedMapInfo"; };
00073     const char * getMD5(){ return "2dc10595ae94de23f22f8a6d2a0eef7a"; };
00074 
00075   };
00076 
00077 }
00078 #endif