Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LaserEcho.h
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 uint32_t echoes_length; 00016 typedef float _echoes_type; 00017 _echoes_type st_echoes; 00018 _echoes_type * echoes; 00019 00020 LaserEcho(): 00021 echoes_length(0), echoes(NULL) 00022 { 00023 } 00024 00025 virtual int serialize(unsigned char *outbuffer) const 00026 { 00027 int offset = 0; 00028 *(outbuffer + offset + 0) = (this->echoes_length >> (8 * 0)) & 0xFF; 00029 *(outbuffer + offset + 1) = (this->echoes_length >> (8 * 1)) & 0xFF; 00030 *(outbuffer + offset + 2) = (this->echoes_length >> (8 * 2)) & 0xFF; 00031 *(outbuffer + offset + 3) = (this->echoes_length >> (8 * 3)) & 0xFF; 00032 offset += sizeof(this->echoes_length); 00033 for( uint32_t i = 0; i < echoes_length; i++){ 00034 union { 00035 float real; 00036 uint32_t base; 00037 } u_echoesi; 00038 u_echoesi.real = this->echoes[i]; 00039 *(outbuffer + offset + 0) = (u_echoesi.base >> (8 * 0)) & 0xFF; 00040 *(outbuffer + offset + 1) = (u_echoesi.base >> (8 * 1)) & 0xFF; 00041 *(outbuffer + offset + 2) = (u_echoesi.base >> (8 * 2)) & 0xFF; 00042 *(outbuffer + offset + 3) = (u_echoesi.base >> (8 * 3)) & 0xFF; 00043 offset += sizeof(this->echoes[i]); 00044 } 00045 return offset; 00046 } 00047 00048 virtual int deserialize(unsigned char *inbuffer) 00049 { 00050 int offset = 0; 00051 uint32_t echoes_lengthT = ((uint32_t) (*(inbuffer + offset))); 00052 echoes_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00053 echoes_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00054 echoes_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00055 offset += sizeof(this->echoes_length); 00056 if(echoes_lengthT > echoes_length) 00057 this->echoes = (float*)realloc(this->echoes, echoes_lengthT * sizeof(float)); 00058 echoes_length = echoes_lengthT; 00059 for( uint32_t i = 0; i < echoes_length; i++){ 00060 union { 00061 float real; 00062 uint32_t base; 00063 } u_st_echoes; 00064 u_st_echoes.base = 0; 00065 u_st_echoes.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00066 u_st_echoes.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00067 u_st_echoes.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00068 u_st_echoes.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00069 this->st_echoes = u_st_echoes.real; 00070 offset += sizeof(this->st_echoes); 00071 memcpy( &(this->echoes[i]), &(this->st_echoes), sizeof(float)); 00072 } 00073 return offset; 00074 } 00075 00076 const char * getType(){ return "sensor_msgs/LaserEcho"; }; 00077 const char * getMD5(){ return "8bc5ae449b200fba4d552b4225586696"; }; 00078 00079 }; 00080 00081 } 00082 #endif
Generated on Wed Jul 13 2022 23:30:18 by
