root / quad2 / arduino / src / ros_lib / nav_msgs / Path.h @ c1426757
History | View | Annotate | Download (1.63 KB)
1 |
#ifndef _ROS_nav_msgs_Path_h
|
---|---|
2 |
#define _ROS_nav_msgs_Path_h
|
3 |
|
4 |
#include <stdint.h> |
5 |
#include <string.h> |
6 |
#include <stdlib.h> |
7 |
#include "ros/msg.h" |
8 |
#include "std_msgs/Header.h" |
9 |
#include "geometry_msgs/PoseStamped.h" |
10 |
|
11 |
namespace nav_msgs |
12 |
{ |
13 |
|
14 |
class Path : public ros::Msg |
15 |
{ |
16 |
public:
|
17 |
std_msgs::Header header; |
18 |
uint8_t poses_length; |
19 |
geometry_msgs::PoseStamped st_poses; |
20 |
geometry_msgs::PoseStamped * poses; |
21 |
|
22 |
virtual int serialize(unsigned char *outbuffer) const |
23 |
{ |
24 |
int offset = 0; |
25 |
offset += this->header.serialize(outbuffer + offset); |
26 |
*(outbuffer + offset++) = poses_length; |
27 |
*(outbuffer + offset++) = 0;
|
28 |
*(outbuffer + offset++) = 0;
|
29 |
*(outbuffer + offset++) = 0;
|
30 |
for( uint8_t i = 0; i < poses_length; i++){ |
31 |
offset += this->poses[i].serialize(outbuffer + offset); |
32 |
} |
33 |
return offset;
|
34 |
} |
35 |
|
36 |
virtual int deserialize(unsigned char *inbuffer) |
37 |
{ |
38 |
int offset = 0; |
39 |
offset += this->header.deserialize(inbuffer + offset); |
40 |
uint8_t poses_lengthT = *(inbuffer + offset++); |
41 |
if(poses_lengthT > poses_length)
|
42 |
this->poses = (geometry_msgs::PoseStamped*)realloc(this->poses, poses_lengthT * sizeof(geometry_msgs::PoseStamped));
|
43 |
offset += 3;
|
44 |
poses_length = poses_lengthT; |
45 |
for( uint8_t i = 0; i < poses_length; i++){ |
46 |
offset += this->st_poses.deserialize(inbuffer + offset); |
47 |
memcpy( &(this->poses[i]), &(this->st_poses), sizeof(geometry_msgs::PoseStamped));
|
48 |
} |
49 |
return offset;
|
50 |
} |
51 |
|
52 |
const char * getType(){ return "nav_msgs/Path"; }; |
53 |
const char * getMD5(){ return "6227e2b7e9cce15051f669a5e197bbf7"; }; |
54 |
|
55 |
}; |
56 |
|
57 |
} |
58 |
#endif
|