ros melodic library with custom message
Dependents: Robot_team1_QEI_Douglas Robot_team1
ros_lib/nav_msgs/Odometry.h@0:020db18a476d, 2019-10-30 (annotated)
- Committer:
- scarter1
- Date:
- Wed Oct 30 14:59:49 2019 +0000
- Revision:
- 0:020db18a476d
melodic library;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
scarter1 | 0:020db18a476d | 1 | #ifndef _ROS_nav_msgs_Odometry_h |
scarter1 | 0:020db18a476d | 2 | #define _ROS_nav_msgs_Odometry_h |
scarter1 | 0:020db18a476d | 3 | |
scarter1 | 0:020db18a476d | 4 | #include <stdint.h> |
scarter1 | 0:020db18a476d | 5 | #include <string.h> |
scarter1 | 0:020db18a476d | 6 | #include <stdlib.h> |
scarter1 | 0:020db18a476d | 7 | #include "ros/msg.h" |
scarter1 | 0:020db18a476d | 8 | #include "std_msgs/Header.h" |
scarter1 | 0:020db18a476d | 9 | #include "geometry_msgs/PoseWithCovariance.h" |
scarter1 | 0:020db18a476d | 10 | #include "geometry_msgs/TwistWithCovariance.h" |
scarter1 | 0:020db18a476d | 11 | |
scarter1 | 0:020db18a476d | 12 | namespace nav_msgs |
scarter1 | 0:020db18a476d | 13 | { |
scarter1 | 0:020db18a476d | 14 | |
scarter1 | 0:020db18a476d | 15 | class Odometry : public ros::Msg |
scarter1 | 0:020db18a476d | 16 | { |
scarter1 | 0:020db18a476d | 17 | public: |
scarter1 | 0:020db18a476d | 18 | typedef std_msgs::Header _header_type; |
scarter1 | 0:020db18a476d | 19 | _header_type header; |
scarter1 | 0:020db18a476d | 20 | typedef const char* _child_frame_id_type; |
scarter1 | 0:020db18a476d | 21 | _child_frame_id_type child_frame_id; |
scarter1 | 0:020db18a476d | 22 | typedef geometry_msgs::PoseWithCovariance _pose_type; |
scarter1 | 0:020db18a476d | 23 | _pose_type pose; |
scarter1 | 0:020db18a476d | 24 | typedef geometry_msgs::TwistWithCovariance _twist_type; |
scarter1 | 0:020db18a476d | 25 | _twist_type twist; |
scarter1 | 0:020db18a476d | 26 | |
scarter1 | 0:020db18a476d | 27 | Odometry(): |
scarter1 | 0:020db18a476d | 28 | header(), |
scarter1 | 0:020db18a476d | 29 | child_frame_id(""), |
scarter1 | 0:020db18a476d | 30 | pose(), |
scarter1 | 0:020db18a476d | 31 | twist() |
scarter1 | 0:020db18a476d | 32 | { |
scarter1 | 0:020db18a476d | 33 | } |
scarter1 | 0:020db18a476d | 34 | |
scarter1 | 0:020db18a476d | 35 | virtual int serialize(unsigned char *outbuffer) const |
scarter1 | 0:020db18a476d | 36 | { |
scarter1 | 0:020db18a476d | 37 | int offset = 0; |
scarter1 | 0:020db18a476d | 38 | offset += this->header.serialize(outbuffer + offset); |
scarter1 | 0:020db18a476d | 39 | uint32_t length_child_frame_id = strlen(this->child_frame_id); |
scarter1 | 0:020db18a476d | 40 | varToArr(outbuffer + offset, length_child_frame_id); |
scarter1 | 0:020db18a476d | 41 | offset += 4; |
scarter1 | 0:020db18a476d | 42 | memcpy(outbuffer + offset, this->child_frame_id, length_child_frame_id); |
scarter1 | 0:020db18a476d | 43 | offset += length_child_frame_id; |
scarter1 | 0:020db18a476d | 44 | offset += this->pose.serialize(outbuffer + offset); |
scarter1 | 0:020db18a476d | 45 | offset += this->twist.serialize(outbuffer + offset); |
scarter1 | 0:020db18a476d | 46 | return offset; |
scarter1 | 0:020db18a476d | 47 | } |
scarter1 | 0:020db18a476d | 48 | |
scarter1 | 0:020db18a476d | 49 | virtual int deserialize(unsigned char *inbuffer) |
scarter1 | 0:020db18a476d | 50 | { |
scarter1 | 0:020db18a476d | 51 | int offset = 0; |
scarter1 | 0:020db18a476d | 52 | offset += this->header.deserialize(inbuffer + offset); |
scarter1 | 0:020db18a476d | 53 | uint32_t length_child_frame_id; |
scarter1 | 0:020db18a476d | 54 | arrToVar(length_child_frame_id, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 55 | offset += 4; |
scarter1 | 0:020db18a476d | 56 | for(unsigned int k= offset; k< offset+length_child_frame_id; ++k){ |
scarter1 | 0:020db18a476d | 57 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 58 | } |
scarter1 | 0:020db18a476d | 59 | inbuffer[offset+length_child_frame_id-1]=0; |
scarter1 | 0:020db18a476d | 60 | this->child_frame_id = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 61 | offset += length_child_frame_id; |
scarter1 | 0:020db18a476d | 62 | offset += this->pose.deserialize(inbuffer + offset); |
scarter1 | 0:020db18a476d | 63 | offset += this->twist.deserialize(inbuffer + offset); |
scarter1 | 0:020db18a476d | 64 | return offset; |
scarter1 | 0:020db18a476d | 65 | } |
scarter1 | 0:020db18a476d | 66 | |
scarter1 | 0:020db18a476d | 67 | const char * getType(){ return "nav_msgs/Odometry"; }; |
scarter1 | 0:020db18a476d | 68 | const char * getMD5(){ return "cd5e73d190d741a2f92e81eda573aca7"; }; |
scarter1 | 0:020db18a476d | 69 | |
scarter1 | 0:020db18a476d | 70 | }; |
scarter1 | 0:020db18a476d | 71 | |
scarter1 | 0:020db18a476d | 72 | } |
scarter1 | 0:020db18a476d | 73 | #endif |