LaserEcho.h
Go to the documentation of this file.
00001 #ifndef _ROS_sensor_msgs_LaserEcho_h
00002 #define _ROS_sensor_msgs_LaserEcho_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace sensor_msgs
00010 {
00011 
00012   class LaserEcho : public ros::Msg
00013   {
00014     public:
00015       uint8_t echoes_length;
00016       float st_echoes;
00017       float * echoes;
00018 
00019     virtual int serialize(unsigned char *outbuffer) const
00020     {
00021       int offset = 0;
00022       *(outbuffer + offset++) = echoes_length;
00023       *(outbuffer + offset++) = 0;
00024       *(outbuffer + offset++) = 0;
00025       *(outbuffer + offset++) = 0;
00026       for( uint8_t i = 0; i < echoes_length; i++){
00027       union {
00028         float real;
00029         uint32_t base;
00030       } u_echoesi;
00031       u_echoesi.real = this->echoes[i];
00032       *(outbuffer + offset + 0) = (u_echoesi.base >> (8 * 0)) & 0xFF;
00033       *(outbuffer + offset + 1) = (u_echoesi.base >> (8 * 1)) & 0xFF;
00034       *(outbuffer + offset + 2) = (u_echoesi.base >> (8 * 2)) & 0xFF;
00035       *(outbuffer + offset + 3) = (u_echoesi.base >> (8 * 3)) & 0xFF;
00036       offset += sizeof(this->echoes[i]);
00037       }
00038       return offset;
00039     }
00040 
00041     virtual int deserialize(unsigned char *inbuffer)
00042     {
00043       int offset = 0;
00044       uint8_t echoes_lengthT = *(inbuffer + offset++);
00045       if(echoes_lengthT > echoes_length)
00046         this->echoes = (float*)realloc(this->echoes, echoes_lengthT * sizeof(float));
00047       offset += 3;
00048       echoes_length = echoes_lengthT;
00049       for( uint8_t i = 0; i < echoes_length; i++){
00050       union {
00051         float real;
00052         uint32_t base;
00053       } u_st_echoes;
00054       u_st_echoes.base = 0;
00055       u_st_echoes.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00056       u_st_echoes.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00057       u_st_echoes.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00058       u_st_echoes.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00059       this->st_echoes = u_st_echoes.real;
00060       offset += sizeof(this->st_echoes);
00061         memcpy( &(this->echoes[i]), &(this->st_echoes), sizeof(float));
00062       }
00063      return offset;
00064     }
00065 
00066     const char * getType(){ return "sensor_msgs/LaserEcho"; };
00067     const char * getMD5(){ return "8bc5ae449b200fba4d552b4225586696"; };
00068 
00069   };
00070 
00071 }
00072 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:49