Skip to content

Commit 8878cc7

Browse files
authored
Merge pull request #9 from mcgill-robotics/PowerBoardRos
update power board embedded code
2 parents 44e3dcc + ab631b2 commit 8878cc7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+991
-6176
lines changed

Power/lib/ros_lib/auv_msgs/DeadReckonReport.h

Lines changed: 21 additions & 210 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ namespace auv_msgs
1212
class DeadReckonReport : public ros::Msg
1313
{
1414
public:
15-
typedef double _x_type;
15+
typedef float _x_type;
1616
_x_type x;
17-
typedef double _y_type;
17+
typedef float _y_type;
1818
_y_type y;
19-
typedef double _z_type;
19+
typedef float _z_type;
2020
_z_type z;
21-
typedef double _roll_type;
21+
typedef float _roll_type;
2222
_roll_type roll;
23-
typedef double _pitch_type;
23+
typedef float _pitch_type;
2424
_pitch_type pitch;
25-
typedef double _yaw_type;
25+
typedef float _yaw_type;
2626
_yaw_type yaw;
27-
typedef double _std_type;
27+
typedef float _std_type;
2828
_std_type std;
2929
typedef bool _status_type;
3030
_status_type status;
@@ -44,104 +44,13 @@ namespace auv_msgs
4444
virtual int serialize(unsigned char *outbuffer) const override
4545
{
4646
int offset = 0;
47-
union {
48-
double real;
49-
uint64_t base;
50-
} u_x;
51-
u_x.real = this->x;
52-
*(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
53-
*(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
54-
*(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
55-
*(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
56-
*(outbuffer + offset + 4) = (u_x.base >> (8 * 4)) & 0xFF;
57-
*(outbuffer + offset + 5) = (u_x.base >> (8 * 5)) & 0xFF;
58-
*(outbuffer + offset + 6) = (u_x.base >> (8 * 6)) & 0xFF;
59-
*(outbuffer + offset + 7) = (u_x.base >> (8 * 7)) & 0xFF;
60-
offset += sizeof(this->x);
61-
union {
62-
double real;
63-
uint64_t base;
64-
} u_y;
65-
u_y.real = this->y;
66-
*(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
67-
*(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
68-
*(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
69-
*(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
70-
*(outbuffer + offset + 4) = (u_y.base >> (8 * 4)) & 0xFF;
71-
*(outbuffer + offset + 5) = (u_y.base >> (8 * 5)) & 0xFF;
72-
*(outbuffer + offset + 6) = (u_y.base >> (8 * 6)) & 0xFF;
73-
*(outbuffer + offset + 7) = (u_y.base >> (8 * 7)) & 0xFF;
74-
offset += sizeof(this->y);
75-
union {
76-
double real;
77-
uint64_t base;
78-
} u_z;
79-
u_z.real = this->z;
80-
*(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
81-
*(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
82-
*(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
83-
*(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
84-
*(outbuffer + offset + 4) = (u_z.base >> (8 * 4)) & 0xFF;
85-
*(outbuffer + offset + 5) = (u_z.base >> (8 * 5)) & 0xFF;
86-
*(outbuffer + offset + 6) = (u_z.base >> (8 * 6)) & 0xFF;
87-
*(outbuffer + offset + 7) = (u_z.base >> (8 * 7)) & 0xFF;
88-
offset += sizeof(this->z);
89-
union {
90-
double real;
91-
uint64_t base;
92-
} u_roll;
93-
u_roll.real = this->roll;
94-
*(outbuffer + offset + 0) = (u_roll.base >> (8 * 0)) & 0xFF;
95-
*(outbuffer + offset + 1) = (u_roll.base >> (8 * 1)) & 0xFF;
96-
*(outbuffer + offset + 2) = (u_roll.base >> (8 * 2)) & 0xFF;
97-
*(outbuffer + offset + 3) = (u_roll.base >> (8 * 3)) & 0xFF;
98-
*(outbuffer + offset + 4) = (u_roll.base >> (8 * 4)) & 0xFF;
99-
*(outbuffer + offset + 5) = (u_roll.base >> (8 * 5)) & 0xFF;
100-
*(outbuffer + offset + 6) = (u_roll.base >> (8 * 6)) & 0xFF;
101-
*(outbuffer + offset + 7) = (u_roll.base >> (8 * 7)) & 0xFF;
102-
offset += sizeof(this->roll);
103-
union {
104-
double real;
105-
uint64_t base;
106-
} u_pitch;
107-
u_pitch.real = this->pitch;
108-
*(outbuffer + offset + 0) = (u_pitch.base >> (8 * 0)) & 0xFF;
109-
*(outbuffer + offset + 1) = (u_pitch.base >> (8 * 1)) & 0xFF;
110-
*(outbuffer + offset + 2) = (u_pitch.base >> (8 * 2)) & 0xFF;
111-
*(outbuffer + offset + 3) = (u_pitch.base >> (8 * 3)) & 0xFF;
112-
*(outbuffer + offset + 4) = (u_pitch.base >> (8 * 4)) & 0xFF;
113-
*(outbuffer + offset + 5) = (u_pitch.base >> (8 * 5)) & 0xFF;
114-
*(outbuffer + offset + 6) = (u_pitch.base >> (8 * 6)) & 0xFF;
115-
*(outbuffer + offset + 7) = (u_pitch.base >> (8 * 7)) & 0xFF;
116-
offset += sizeof(this->pitch);
117-
union {
118-
double real;
119-
uint64_t base;
120-
} u_yaw;
121-
u_yaw.real = this->yaw;
122-
*(outbuffer + offset + 0) = (u_yaw.base >> (8 * 0)) & 0xFF;
123-
*(outbuffer + offset + 1) = (u_yaw.base >> (8 * 1)) & 0xFF;
124-
*(outbuffer + offset + 2) = (u_yaw.base >> (8 * 2)) & 0xFF;
125-
*(outbuffer + offset + 3) = (u_yaw.base >> (8 * 3)) & 0xFF;
126-
*(outbuffer + offset + 4) = (u_yaw.base >> (8 * 4)) & 0xFF;
127-
*(outbuffer + offset + 5) = (u_yaw.base >> (8 * 5)) & 0xFF;
128-
*(outbuffer + offset + 6) = (u_yaw.base >> (8 * 6)) & 0xFF;
129-
*(outbuffer + offset + 7) = (u_yaw.base >> (8 * 7)) & 0xFF;
130-
offset += sizeof(this->yaw);
131-
union {
132-
double real;
133-
uint64_t base;
134-
} u_std;
135-
u_std.real = this->std;
136-
*(outbuffer + offset + 0) = (u_std.base >> (8 * 0)) & 0xFF;
137-
*(outbuffer + offset + 1) = (u_std.base >> (8 * 1)) & 0xFF;
138-
*(outbuffer + offset + 2) = (u_std.base >> (8 * 2)) & 0xFF;
139-
*(outbuffer + offset + 3) = (u_std.base >> (8 * 3)) & 0xFF;
140-
*(outbuffer + offset + 4) = (u_std.base >> (8 * 4)) & 0xFF;
141-
*(outbuffer + offset + 5) = (u_std.base >> (8 * 5)) & 0xFF;
142-
*(outbuffer + offset + 6) = (u_std.base >> (8 * 6)) & 0xFF;
143-
*(outbuffer + offset + 7) = (u_std.base >> (8 * 7)) & 0xFF;
144-
offset += sizeof(this->std);
47+
offset += serializeAvrFloat64(outbuffer + offset, this->x);
48+
offset += serializeAvrFloat64(outbuffer + offset, this->y);
49+
offset += serializeAvrFloat64(outbuffer + offset, this->z);
50+
offset += serializeAvrFloat64(outbuffer + offset, this->roll);
51+
offset += serializeAvrFloat64(outbuffer + offset, this->pitch);
52+
offset += serializeAvrFloat64(outbuffer + offset, this->yaw);
53+
offset += serializeAvrFloat64(outbuffer + offset, this->std);
14554
union {
14655
bool real;
14756
uint8_t base;
@@ -155,111 +64,13 @@ namespace auv_msgs
15564
virtual int deserialize(unsigned char *inbuffer) override
15665
{
15766
int offset = 0;
158-
union {
159-
double real;
160-
uint64_t base;
161-
} u_x;
162-
u_x.base = 0;
163-
u_x.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
164-
u_x.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
165-
u_x.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
166-
u_x.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
167-
u_x.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
168-
u_x.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
169-
u_x.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
170-
u_x.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
171-
this->x = u_x.real;
172-
offset += sizeof(this->x);
173-
union {
174-
double real;
175-
uint64_t base;
176-
} u_y;
177-
u_y.base = 0;
178-
u_y.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
179-
u_y.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
180-
u_y.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
181-
u_y.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
182-
u_y.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
183-
u_y.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
184-
u_y.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
185-
u_y.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
186-
this->y = u_y.real;
187-
offset += sizeof(this->y);
188-
union {
189-
double real;
190-
uint64_t base;
191-
} u_z;
192-
u_z.base = 0;
193-
u_z.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
194-
u_z.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
195-
u_z.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
196-
u_z.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
197-
u_z.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
198-
u_z.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
199-
u_z.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
200-
u_z.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
201-
this->z = u_z.real;
202-
offset += sizeof(this->z);
203-
union {
204-
double real;
205-
uint64_t base;
206-
} u_roll;
207-
u_roll.base = 0;
208-
u_roll.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
209-
u_roll.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
210-
u_roll.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
211-
u_roll.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
212-
u_roll.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
213-
u_roll.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
214-
u_roll.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
215-
u_roll.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
216-
this->roll = u_roll.real;
217-
offset += sizeof(this->roll);
218-
union {
219-
double real;
220-
uint64_t base;
221-
} u_pitch;
222-
u_pitch.base = 0;
223-
u_pitch.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
224-
u_pitch.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
225-
u_pitch.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
226-
u_pitch.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
227-
u_pitch.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
228-
u_pitch.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
229-
u_pitch.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
230-
u_pitch.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
231-
this->pitch = u_pitch.real;
232-
offset += sizeof(this->pitch);
233-
union {
234-
double real;
235-
uint64_t base;
236-
} u_yaw;
237-
u_yaw.base = 0;
238-
u_yaw.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
239-
u_yaw.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
240-
u_yaw.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
241-
u_yaw.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
242-
u_yaw.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
243-
u_yaw.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
244-
u_yaw.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
245-
u_yaw.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
246-
this->yaw = u_yaw.real;
247-
offset += sizeof(this->yaw);
248-
union {
249-
double real;
250-
uint64_t base;
251-
} u_std;
252-
u_std.base = 0;
253-
u_std.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
254-
u_std.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
255-
u_std.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
256-
u_std.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
257-
u_std.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
258-
u_std.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
259-
u_std.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
260-
u_std.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
261-
this->std = u_std.real;
262-
offset += sizeof(this->std);
67+
offset += deserializeAvrFloat64(inbuffer + offset, &(this->x));
68+
offset += deserializeAvrFloat64(inbuffer + offset, &(this->y));
69+
offset += deserializeAvrFloat64(inbuffer + offset, &(this->z));
70+
offset += deserializeAvrFloat64(inbuffer + offset, &(this->roll));
71+
offset += deserializeAvrFloat64(inbuffer + offset, &(this->pitch));
72+
offset += deserializeAvrFloat64(inbuffer + offset, &(this->yaw));
73+
offset += deserializeAvrFloat64(inbuffer + offset, &(this->std));
26374
union {
26475
bool real;
26576
uint8_t base;

0 commit comments

Comments
 (0)