ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
ColorRGBA.h
00001 #ifndef _ROS_std_msgs_ColorRGBA_h 00002 #define _ROS_std_msgs_ColorRGBA_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace std_msgs 00010 { 00011 00012 class ColorRGBA : public ros::Msg 00013 { 00014 public: 00015 float r; 00016 float g; 00017 float b; 00018 float a; 00019 00020 ColorRGBA(): 00021 r(0), 00022 g(0), 00023 b(0), 00024 a(0) 00025 { 00026 } 00027 00028 virtual int serialize(unsigned char *outbuffer) const 00029 { 00030 int offset = 0; 00031 union { 00032 float real; 00033 uint32_t base; 00034 } u_r; 00035 u_r.real = this->r; 00036 *(outbuffer + offset + 0) = (u_r.base >> (8 * 0)) & 0xFF; 00037 *(outbuffer + offset + 1) = (u_r.base >> (8 * 1)) & 0xFF; 00038 *(outbuffer + offset + 2) = (u_r.base >> (8 * 2)) & 0xFF; 00039 *(outbuffer + offset + 3) = (u_r.base >> (8 * 3)) & 0xFF; 00040 offset += sizeof(this->r); 00041 union { 00042 float real; 00043 uint32_t base; 00044 } u_g; 00045 u_g.real = this->g; 00046 *(outbuffer + offset + 0) = (u_g.base >> (8 * 0)) & 0xFF; 00047 *(outbuffer + offset + 1) = (u_g.base >> (8 * 1)) & 0xFF; 00048 *(outbuffer + offset + 2) = (u_g.base >> (8 * 2)) & 0xFF; 00049 *(outbuffer + offset + 3) = (u_g.base >> (8 * 3)) & 0xFF; 00050 offset += sizeof(this->g); 00051 union { 00052 float real; 00053 uint32_t base; 00054 } u_b; 00055 u_b.real = this->b; 00056 *(outbuffer + offset + 0) = (u_b.base >> (8 * 0)) & 0xFF; 00057 *(outbuffer + offset + 1) = (u_b.base >> (8 * 1)) & 0xFF; 00058 *(outbuffer + offset + 2) = (u_b.base >> (8 * 2)) & 0xFF; 00059 *(outbuffer + offset + 3) = (u_b.base >> (8 * 3)) & 0xFF; 00060 offset += sizeof(this->b); 00061 union { 00062 float real; 00063 uint32_t base; 00064 } u_a; 00065 u_a.real = this->a; 00066 *(outbuffer + offset + 0) = (u_a.base >> (8 * 0)) & 0xFF; 00067 *(outbuffer + offset + 1) = (u_a.base >> (8 * 1)) & 0xFF; 00068 *(outbuffer + offset + 2) = (u_a.base >> (8 * 2)) & 0xFF; 00069 *(outbuffer + offset + 3) = (u_a.base >> (8 * 3)) & 0xFF; 00070 offset += sizeof(this->a); 00071 return offset; 00072 } 00073 00074 virtual int deserialize(unsigned char *inbuffer) 00075 { 00076 int offset = 0; 00077 union { 00078 float real; 00079 uint32_t base; 00080 } u_r; 00081 u_r.base = 0; 00082 u_r.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00083 u_r.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00084 u_r.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00085 u_r.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00086 this->r = u_r.real; 00087 offset += sizeof(this->r); 00088 union { 00089 float real; 00090 uint32_t base; 00091 } u_g; 00092 u_g.base = 0; 00093 u_g.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00094 u_g.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00095 u_g.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00096 u_g.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00097 this->g = u_g.real; 00098 offset += sizeof(this->g); 00099 union { 00100 float real; 00101 uint32_t base; 00102 } u_b; 00103 u_b.base = 0; 00104 u_b.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00105 u_b.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00106 u_b.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00107 u_b.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00108 this->b = u_b.real; 00109 offset += sizeof(this->b); 00110 union { 00111 float real; 00112 uint32_t base; 00113 } u_a; 00114 u_a.base = 0; 00115 u_a.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00116 u_a.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00117 u_a.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00118 u_a.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00119 this->a = u_a.real; 00120 offset += sizeof(this->a); 00121 return offset; 00122 } 00123 00124 const char * getType(){ return "std_msgs/ColorRGBA"; }; 00125 const char * getMD5(){ return "a29a96539573343b1310c73607334b00"; }; 00126 00127 }; 00128 00129 } 00130 #endif
Generated on Tue Jul 12 2022 18:39:38 by 1.7.2