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.
Pose.h
00001 #ifndef _ROS_turtlesim_Pose_h 00002 #define _ROS_turtlesim_Pose_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace turtlesim 00010 { 00011 00012 class Pose : public ros::Msg 00013 { 00014 public: 00015 typedef float _x_type; 00016 _x_type x; 00017 typedef float _y_type; 00018 _y_type y; 00019 typedef float _theta_type; 00020 _theta_type theta; 00021 typedef float _linear_velocity_type; 00022 _linear_velocity_type linear_velocity; 00023 typedef float _angular_velocity_type; 00024 _angular_velocity_type angular_velocity; 00025 00026 Pose(): 00027 x(0), 00028 y(0), 00029 theta(0), 00030 linear_velocity(0), 00031 angular_velocity(0) 00032 { 00033 } 00034 00035 virtual int serialize(unsigned char *outbuffer) const 00036 { 00037 int offset = 0; 00038 union { 00039 float real; 00040 uint32_t base; 00041 } u_x; 00042 u_x.real = this->x; 00043 *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF; 00044 *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF; 00045 *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF; 00046 *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF; 00047 offset += sizeof(this->x); 00048 union { 00049 float real; 00050 uint32_t base; 00051 } u_y; 00052 u_y.real = this->y; 00053 *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF; 00054 *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF; 00055 *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF; 00056 *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF; 00057 offset += sizeof(this->y); 00058 union { 00059 float real; 00060 uint32_t base; 00061 } u_theta; 00062 u_theta.real = this->theta; 00063 *(outbuffer + offset + 0) = (u_theta.base >> (8 * 0)) & 0xFF; 00064 *(outbuffer + offset + 1) = (u_theta.base >> (8 * 1)) & 0xFF; 00065 *(outbuffer + offset + 2) = (u_theta.base >> (8 * 2)) & 0xFF; 00066 *(outbuffer + offset + 3) = (u_theta.base >> (8 * 3)) & 0xFF; 00067 offset += sizeof(this->theta); 00068 union { 00069 float real; 00070 uint32_t base; 00071 } u_linear_velocity; 00072 u_linear_velocity.real = this->linear_velocity; 00073 *(outbuffer + offset + 0) = (u_linear_velocity.base >> (8 * 0)) & 0xFF; 00074 *(outbuffer + offset + 1) = (u_linear_velocity.base >> (8 * 1)) & 0xFF; 00075 *(outbuffer + offset + 2) = (u_linear_velocity.base >> (8 * 2)) & 0xFF; 00076 *(outbuffer + offset + 3) = (u_linear_velocity.base >> (8 * 3)) & 0xFF; 00077 offset += sizeof(this->linear_velocity); 00078 union { 00079 float real; 00080 uint32_t base; 00081 } u_angular_velocity; 00082 u_angular_velocity.real = this->angular_velocity; 00083 *(outbuffer + offset + 0) = (u_angular_velocity.base >> (8 * 0)) & 0xFF; 00084 *(outbuffer + offset + 1) = (u_angular_velocity.base >> (8 * 1)) & 0xFF; 00085 *(outbuffer + offset + 2) = (u_angular_velocity.base >> (8 * 2)) & 0xFF; 00086 *(outbuffer + offset + 3) = (u_angular_velocity.base >> (8 * 3)) & 0xFF; 00087 offset += sizeof(this->angular_velocity); 00088 return offset; 00089 } 00090 00091 virtual int deserialize(unsigned char *inbuffer) 00092 { 00093 int offset = 0; 00094 union { 00095 float real; 00096 uint32_t base; 00097 } u_x; 00098 u_x.base = 0; 00099 u_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00100 u_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00101 u_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00102 u_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00103 this->x = u_x.real; 00104 offset += sizeof(this->x); 00105 union { 00106 float real; 00107 uint32_t base; 00108 } u_y; 00109 u_y.base = 0; 00110 u_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00111 u_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00112 u_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00113 u_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00114 this->y = u_y.real; 00115 offset += sizeof(this->y); 00116 union { 00117 float real; 00118 uint32_t base; 00119 } u_theta; 00120 u_theta.base = 0; 00121 u_theta.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00122 u_theta.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00123 u_theta.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00124 u_theta.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00125 this->theta = u_theta.real; 00126 offset += sizeof(this->theta); 00127 union { 00128 float real; 00129 uint32_t base; 00130 } u_linear_velocity; 00131 u_linear_velocity.base = 0; 00132 u_linear_velocity.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00133 u_linear_velocity.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00134 u_linear_velocity.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00135 u_linear_velocity.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00136 this->linear_velocity = u_linear_velocity.real; 00137 offset += sizeof(this->linear_velocity); 00138 union { 00139 float real; 00140 uint32_t base; 00141 } u_angular_velocity; 00142 u_angular_velocity.base = 0; 00143 u_angular_velocity.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00144 u_angular_velocity.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00145 u_angular_velocity.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00146 u_angular_velocity.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00147 this->angular_velocity = u_angular_velocity.real; 00148 offset += sizeof(this->angular_velocity); 00149 return offset; 00150 } 00151 00152 const char * getType(){ return "turtlesim/Pose"; }; 00153 const char * getMD5(){ return "863b248d5016ca62ea2e895ae5265cf9"; }; 00154 00155 }; 00156 00157 } 00158 #endif
Generated on Wed Jul 13 2022 23:30:18 by
