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.
Velocity.h
00001 #ifndef _ROS_turtle_actionlib_Velocity_h 00002 #define _ROS_turtle_actionlib_Velocity_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace turtle_actionlib 00010 { 00011 00012 class Velocity : public ros::Msg 00013 { 00014 public: 00015 typedef float _linear_type; 00016 _linear_type linear; 00017 typedef float _angular_type; 00018 _angular_type angular; 00019 00020 Velocity(): 00021 linear(0), 00022 angular(0) 00023 { 00024 } 00025 00026 virtual int serialize(unsigned char *outbuffer) const 00027 { 00028 int offset = 0; 00029 union { 00030 float real; 00031 uint32_t base; 00032 } u_linear; 00033 u_linear.real = this->linear; 00034 *(outbuffer + offset + 0) = (u_linear.base >> (8 * 0)) & 0xFF; 00035 *(outbuffer + offset + 1) = (u_linear.base >> (8 * 1)) & 0xFF; 00036 *(outbuffer + offset + 2) = (u_linear.base >> (8 * 2)) & 0xFF; 00037 *(outbuffer + offset + 3) = (u_linear.base >> (8 * 3)) & 0xFF; 00038 offset += sizeof(this->linear); 00039 union { 00040 float real; 00041 uint32_t base; 00042 } u_angular; 00043 u_angular.real = this->angular; 00044 *(outbuffer + offset + 0) = (u_angular.base >> (8 * 0)) & 0xFF; 00045 *(outbuffer + offset + 1) = (u_angular.base >> (8 * 1)) & 0xFF; 00046 *(outbuffer + offset + 2) = (u_angular.base >> (8 * 2)) & 0xFF; 00047 *(outbuffer + offset + 3) = (u_angular.base >> (8 * 3)) & 0xFF; 00048 offset += sizeof(this->angular); 00049 return offset; 00050 } 00051 00052 virtual int deserialize(unsigned char *inbuffer) 00053 { 00054 int offset = 0; 00055 union { 00056 float real; 00057 uint32_t base; 00058 } u_linear; 00059 u_linear.base = 0; 00060 u_linear.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00061 u_linear.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00062 u_linear.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00063 u_linear.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00064 this->linear = u_linear.real; 00065 offset += sizeof(this->linear); 00066 union { 00067 float real; 00068 uint32_t base; 00069 } u_angular; 00070 u_angular.base = 0; 00071 u_angular.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); 00072 u_angular.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00073 u_angular.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00074 u_angular.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00075 this->angular = u_angular.real; 00076 offset += sizeof(this->angular); 00077 return offset; 00078 } 00079 00080 const char * getType(){ return "turtle_actionlib/Velocity"; }; 00081 const char * getMD5(){ return "9d5c2dcd348ac8f76ce2a4307bd63a13"; }; 00082 00083 }; 00084 00085 } 00086 #endif
Generated on Wed Jul 13 2022 23:30:19 by
