ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

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       double x;
00017       double y;
00018       double width;
00019       double height;
00020       double min_z;
00021       double 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       union {
00043         double real;
00044         uint64_t base;
00045       } u_x;
00046       u_x.real = this->x;
00047       *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
00048       *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
00049       *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
00050       *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
00051       *(outbuffer + offset + 4) = (u_x.base >> (8 * 4)) & 0xFF;
00052       *(outbuffer + offset + 5) = (u_x.base >> (8 * 5)) & 0xFF;
00053       *(outbuffer + offset + 6) = (u_x.base >> (8 * 6)) & 0xFF;
00054       *(outbuffer + offset + 7) = (u_x.base >> (8 * 7)) & 0xFF;
00055       offset += sizeof(this->x);
00056       union {
00057         double real;
00058         uint64_t base;
00059       } u_y;
00060       u_y.real = this->y;
00061       *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
00062       *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
00063       *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
00064       *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
00065       *(outbuffer + offset + 4) = (u_y.base >> (8 * 4)) & 0xFF;
00066       *(outbuffer + offset + 5) = (u_y.base >> (8 * 5)) & 0xFF;
00067       *(outbuffer + offset + 6) = (u_y.base >> (8 * 6)) & 0xFF;
00068       *(outbuffer + offset + 7) = (u_y.base >> (8 * 7)) & 0xFF;
00069       offset += sizeof(this->y);
00070       union {
00071         double real;
00072         uint64_t base;
00073       } u_width;
00074       u_width.real = this->width;
00075       *(outbuffer + offset + 0) = (u_width.base >> (8 * 0)) & 0xFF;
00076       *(outbuffer + offset + 1) = (u_width.base >> (8 * 1)) & 0xFF;
00077       *(outbuffer + offset + 2) = (u_width.base >> (8 * 2)) & 0xFF;
00078       *(outbuffer + offset + 3) = (u_width.base >> (8 * 3)) & 0xFF;
00079       *(outbuffer + offset + 4) = (u_width.base >> (8 * 4)) & 0xFF;
00080       *(outbuffer + offset + 5) = (u_width.base >> (8 * 5)) & 0xFF;
00081       *(outbuffer + offset + 6) = (u_width.base >> (8 * 6)) & 0xFF;
00082       *(outbuffer + offset + 7) = (u_width.base >> (8 * 7)) & 0xFF;
00083       offset += sizeof(this->width);
00084       union {
00085         double real;
00086         uint64_t base;
00087       } u_height;
00088       u_height.real = this->height;
00089       *(outbuffer + offset + 0) = (u_height.base >> (8 * 0)) & 0xFF;
00090       *(outbuffer + offset + 1) = (u_height.base >> (8 * 1)) & 0xFF;
00091       *(outbuffer + offset + 2) = (u_height.base >> (8 * 2)) & 0xFF;
00092       *(outbuffer + offset + 3) = (u_height.base >> (8 * 3)) & 0xFF;
00093       *(outbuffer + offset + 4) = (u_height.base >> (8 * 4)) & 0xFF;
00094       *(outbuffer + offset + 5) = (u_height.base >> (8 * 5)) & 0xFF;
00095       *(outbuffer + offset + 6) = (u_height.base >> (8 * 6)) & 0xFF;
00096       *(outbuffer + offset + 7) = (u_height.base >> (8 * 7)) & 0xFF;
00097       offset += sizeof(this->height);
00098       union {
00099         double real;
00100         uint64_t base;
00101       } u_min_z;
00102       u_min_z.real = this->min_z;
00103       *(outbuffer + offset + 0) = (u_min_z.base >> (8 * 0)) & 0xFF;
00104       *(outbuffer + offset + 1) = (u_min_z.base >> (8 * 1)) & 0xFF;
00105       *(outbuffer + offset + 2) = (u_min_z.base >> (8 * 2)) & 0xFF;
00106       *(outbuffer + offset + 3) = (u_min_z.base >> (8 * 3)) & 0xFF;
00107       *(outbuffer + offset + 4) = (u_min_z.base >> (8 * 4)) & 0xFF;
00108       *(outbuffer + offset + 5) = (u_min_z.base >> (8 * 5)) & 0xFF;
00109       *(outbuffer + offset + 6) = (u_min_z.base >> (8 * 6)) & 0xFF;
00110       *(outbuffer + offset + 7) = (u_min_z.base >> (8 * 7)) & 0xFF;
00111       offset += sizeof(this->min_z);
00112       union {
00113         double real;
00114         uint64_t base;
00115       } u_max_z;
00116       u_max_z.real = this->max_z;
00117       *(outbuffer + offset + 0) = (u_max_z.base >> (8 * 0)) & 0xFF;
00118       *(outbuffer + offset + 1) = (u_max_z.base >> (8 * 1)) & 0xFF;
00119       *(outbuffer + offset + 2) = (u_max_z.base >> (8 * 2)) & 0xFF;
00120       *(outbuffer + offset + 3) = (u_max_z.base >> (8 * 3)) & 0xFF;
00121       *(outbuffer + offset + 4) = (u_max_z.base >> (8 * 4)) & 0xFF;
00122       *(outbuffer + offset + 5) = (u_max_z.base >> (8 * 5)) & 0xFF;
00123       *(outbuffer + offset + 6) = (u_max_z.base >> (8 * 6)) & 0xFF;
00124       *(outbuffer + offset + 7) = (u_max_z.base >> (8 * 7)) & 0xFF;
00125       offset += sizeof(this->max_z);
00126       return offset;
00127     }
00128 
00129     virtual int deserialize(unsigned char *inbuffer)
00130     {
00131       int offset = 0;
00132       uint32_t length_frame_id;
00133       memcpy(&length_frame_id, (inbuffer + offset), sizeof(uint32_t));
00134       offset += 4;
00135       for(unsigned int k= offset; k< offset+length_frame_id; ++k){
00136           inbuffer[k-1]=inbuffer[k];
00137       }
00138       inbuffer[offset+length_frame_id-1]=0;
00139       this->frame_id = (char *)(inbuffer + offset-1);
00140       offset += length_frame_id;
00141       union {
00142         double real;
00143         uint64_t base;
00144       } u_x;
00145       u_x.base = 0;
00146       u_x.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00147       u_x.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00148       u_x.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00149       u_x.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00150       u_x.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00151       u_x.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00152       u_x.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00153       u_x.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00154       this->x = u_x.real;
00155       offset += sizeof(this->x);
00156       union {
00157         double real;
00158         uint64_t base;
00159       } u_y;
00160       u_y.base = 0;
00161       u_y.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00162       u_y.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00163       u_y.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00164       u_y.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00165       u_y.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00166       u_y.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00167       u_y.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00168       u_y.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00169       this->y = u_y.real;
00170       offset += sizeof(this->y);
00171       union {
00172         double real;
00173         uint64_t base;
00174       } u_width;
00175       u_width.base = 0;
00176       u_width.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00177       u_width.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00178       u_width.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00179       u_width.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00180       u_width.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00181       u_width.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00182       u_width.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00183       u_width.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00184       this->width = u_width.real;
00185       offset += sizeof(this->width);
00186       union {
00187         double real;
00188         uint64_t base;
00189       } u_height;
00190       u_height.base = 0;
00191       u_height.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00192       u_height.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00193       u_height.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00194       u_height.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00195       u_height.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00196       u_height.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00197       u_height.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00198       u_height.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00199       this->height = u_height.real;
00200       offset += sizeof(this->height);
00201       union {
00202         double real;
00203         uint64_t base;
00204       } u_min_z;
00205       u_min_z.base = 0;
00206       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00207       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00208       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00209       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00210       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00211       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00212       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00213       u_min_z.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00214       this->min_z = u_min_z.real;
00215       offset += sizeof(this->min_z);
00216       union {
00217         double real;
00218         uint64_t base;
00219       } u_max_z;
00220       u_max_z.base = 0;
00221       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00222       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00223       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00224       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00225       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00226       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00227       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00228       u_max_z.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00229       this->max_z = u_max_z.real;
00230       offset += sizeof(this->max_z);
00231      return offset;
00232     }
00233 
00234     const char * getType(){ return "map_msgs/ProjectedMapInfo"; };
00235     const char * getMD5(){ return "2dc10595ae94de23f22f8a6d2a0eef7a"; };
00236 
00237   };
00238 
00239 }
00240 #endif