Quaternion.h
Go to the documentation of this file.
1 #ifndef _ROS_rosabridge_msgs_Quaternion_h
2 #define _ROS_rosabridge_msgs_Quaternion_h
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include "ros/msg.h"
8 
9 namespace rosabridge_msgs
10 {
11 
12  class Quaternion : public ros::Msg
13  {
14  public:
15  float x;
16  float y;
17  float z;
18  float w;
19 
20  virtual int serialize(unsigned char *outbuffer) const
21  {
22  int offset = 0;
23  union {
24  float real;
25  uint32_t base;
26  } u_x;
27  u_x.real = this->x;
28  *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
29  *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
30  *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
31  *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
32  offset += sizeof(this->x);
33  union {
34  float real;
35  uint32_t base;
36  } u_y;
37  u_y.real = this->y;
38  *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
39  *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
40  *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
41  *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
42  offset += sizeof(this->y);
43  union {
44  float real;
45  uint32_t base;
46  } u_z;
47  u_z.real = this->z;
48  *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
49  *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
50  *(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
51  *(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
52  offset += sizeof(this->z);
53  union {
54  float real;
55  uint32_t base;
56  } u_w;
57  u_w.real = this->w;
58  *(outbuffer + offset + 0) = (u_w.base >> (8 * 0)) & 0xFF;
59  *(outbuffer + offset + 1) = (u_w.base >> (8 * 1)) & 0xFF;
60  *(outbuffer + offset + 2) = (u_w.base >> (8 * 2)) & 0xFF;
61  *(outbuffer + offset + 3) = (u_w.base >> (8 * 3)) & 0xFF;
62  offset += sizeof(this->w);
63  return offset;
64  }
65 
66  virtual int deserialize(unsigned char *inbuffer)
67  {
68  int offset = 0;
69  union {
70  float real;
71  uint32_t base;
72  } u_x;
73  u_x.base = 0;
74  u_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
75  u_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
76  u_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
77  u_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
78  this->x = u_x.real;
79  offset += sizeof(this->x);
80  union {
81  float real;
82  uint32_t base;
83  } u_y;
84  u_y.base = 0;
85  u_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
86  u_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
87  u_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
88  u_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
89  this->y = u_y.real;
90  offset += sizeof(this->y);
91  union {
92  float real;
93  uint32_t base;
94  } u_z;
95  u_z.base = 0;
96  u_z.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
97  u_z.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
98  u_z.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
99  u_z.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
100  this->z = u_z.real;
101  offset += sizeof(this->z);
102  union {
103  float real;
104  uint32_t base;
105  } u_w;
106  u_w.base = 0;
107  u_w.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
108  u_w.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
109  u_w.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
110  u_w.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
111  this->w = u_w.real;
112  offset += sizeof(this->w);
113  return offset;
114  }
115 
116  const char * getType(){ return "rosabridge_msgs/Quaternion"; };
117  const char * getMD5(){ return "c3a70de85a9dd451c31fa86cab10a939"; };
118 
119  };
120 
121 }
122 #endif
virtual int deserialize(unsigned char *inbuffer)
Definition: Quaternion.h:66
virtual int serialize(unsigned char *outbuffer) const
Definition: Quaternion.h:20


rosabridge_arduino
Author(s): Chad Attermann
autogenerated on Sat Apr 10 2021 02:37:49