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.
SonarArray.h
00001 #ifndef _ROS_zetabot_main_SonarArray_h 00002 #define _ROS_zetabot_main_SonarArray_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace zetabot_main 00010 { 00011 00012 class SonarArray : public ros::Msg 00013 { 00014 public: 00015 float data[10]; 00016 00017 SonarArray(): 00018 data() 00019 { 00020 } 00021 00022 virtual int serialize(unsigned char *outbuffer) const 00023 { 00024 int offset = 0; 00025 for( uint32_t i = 0; i < 10; i++){ 00026 union { 00027 float real; 00028 uint32_t base; 00029 } u_datai; 00030 u_datai.real = this->data[i]; 00031 *(outbuffer + offset + 0) = (u_datai.base >> (8 * 0)) & 0xFF; 00032 *(outbuffer + offset + 1) = (u_datai.base >> (8 * 1)) & 0xFF; 00033 *(outbuffer + offset + 2) = (u_datai.base >> (8 * 2)) & 0xFF; 00034 *(outbuffer + offset + 3) = (u_datai.base >> (8 * 3)) & 0xFF; 00035 offset += sizeof(this->data[i]); 00036 } 00037 return offset; 00038 } 00039 00040 virtual int deserialize(unsigned char *inbuffer) 00041 { 00042 int offset = 0; 00043 for( uint32_t i = 0; i < 10; i++){ 00044 union { 00045 float real; 00046 uint32_t base; 00047 } u_datai; 00048 u_datai.base = 0; 00049 u_datai.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00050 u_datai.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00051 u_datai.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00052 u_datai.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00053 this->data[i] = u_datai.real; 00054 offset += sizeof(this->data[i]); 00055 } 00056 return offset; 00057 } 00058 00059 const char * getType(){ return "zetabot_main/SonarArray"; }; 00060 const char * getMD5(){ return "20c51f19eb629e3866f0586fd6ddf716"; }; 00061 00062 }; 00063 00064 } 00065 #endif
Generated on Tue Jul 12 2022 18:31:24 by
1.7.2