Go to the documentation of this file.00001 #ifndef _ROS_rosabridge_msgs_Quaternion_h
00002 #define _ROS_rosabridge_msgs_Quaternion_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008
00009 namespace rosabridge_msgs
00010 {
00011
00012 class Quaternion : public ros::Msg
00013 {
00014 public:
00015 float x;
00016 float y;
00017 float z;
00018 float w;
00019
00020 virtual int serialize(unsigned char *outbuffer) const
00021 {
00022 int offset = 0;
00023 union {
00024 float real;
00025 uint32_t base;
00026 } u_x;
00027 u_x.real = this->x;
00028 *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
00029 *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
00030 *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
00031 *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
00032 offset += sizeof(this->x);
00033 union {
00034 float real;
00035 uint32_t base;
00036 } u_y;
00037 u_y.real = this->y;
00038 *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
00039 *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
00040 *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
00041 *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
00042 offset += sizeof(this->y);
00043 union {
00044 float real;
00045 uint32_t base;
00046 } u_z;
00047 u_z.real = this->z;
00048 *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
00049 *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
00050 *(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
00051 *(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
00052 offset += sizeof(this->z);
00053 union {
00054 float real;
00055 uint32_t base;
00056 } u_w;
00057 u_w.real = this->w;
00058 *(outbuffer + offset + 0) = (u_w.base >> (8 * 0)) & 0xFF;
00059 *(outbuffer + offset + 1) = (u_w.base >> (8 * 1)) & 0xFF;
00060 *(outbuffer + offset + 2) = (u_w.base >> (8 * 2)) & 0xFF;
00061 *(outbuffer + offset + 3) = (u_w.base >> (8 * 3)) & 0xFF;
00062 offset += sizeof(this->w);
00063 return offset;
00064 }
00065
00066 virtual int deserialize(unsigned char *inbuffer)
00067 {
00068 int offset = 0;
00069 union {
00070 float real;
00071 uint32_t base;
00072 } u_x;
00073 u_x.base = 0;
00074 u_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00075 u_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00076 u_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00077 u_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00078 this->x = u_x.real;
00079 offset += sizeof(this->x);
00080 union {
00081 float real;
00082 uint32_t base;
00083 } u_y;
00084 u_y.base = 0;
00085 u_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00086 u_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00087 u_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00088 u_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00089 this->y = u_y.real;
00090 offset += sizeof(this->y);
00091 union {
00092 float real;
00093 uint32_t base;
00094 } u_z;
00095 u_z.base = 0;
00096 u_z.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00097 u_z.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00098 u_z.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00099 u_z.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00100 this->z = u_z.real;
00101 offset += sizeof(this->z);
00102 union {
00103 float real;
00104 uint32_t base;
00105 } u_w;
00106 u_w.base = 0;
00107 u_w.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00108 u_w.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00109 u_w.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00110 u_w.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00111 this->w = u_w.real;
00112 offset += sizeof(this->w);
00113 return offset;
00114 }
00115
00116 const char * getType(){ return "rosabridge_msgs/Quaternion"; };
00117 const char * getMD5(){ return "c3a70de85a9dd451c31fa86cab10a939"; };
00118
00119 };
00120
00121 }
00122 #endif