ROS Serial library for Mbed platforms for ROS Melodic Morenia. Check http://wiki.ros.org/rosserial_mbed/ for more information.

Dependencies:   BufferedSerial

Committer:
howanglam3
Date:
Thu Aug 18 07:35:12 2022 +0000
Revision:
2:4480021e9f58
Parent:
0:04ac6be8229a
unchanged

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gary Servin 0:04ac6be8229a 1 #ifndef _ROS_SERVICE_GetPlan_h
Gary Servin 0:04ac6be8229a 2 #define _ROS_SERVICE_GetPlan_h
Gary Servin 0:04ac6be8229a 3 #include <stdint.h>
Gary Servin 0:04ac6be8229a 4 #include <string.h>
Gary Servin 0:04ac6be8229a 5 #include <stdlib.h>
Gary Servin 0:04ac6be8229a 6 #include "ros/msg.h"
Gary Servin 0:04ac6be8229a 7 #include "geometry_msgs/PoseStamped.h"
Gary Servin 0:04ac6be8229a 8 #include "nav_msgs/Path.h"
Gary Servin 0:04ac6be8229a 9
Gary Servin 0:04ac6be8229a 10 namespace nav_msgs
Gary Servin 0:04ac6be8229a 11 {
Gary Servin 0:04ac6be8229a 12
Gary Servin 0:04ac6be8229a 13 static const char GETPLAN[] = "nav_msgs/GetPlan";
Gary Servin 0:04ac6be8229a 14
Gary Servin 0:04ac6be8229a 15 class GetPlanRequest : public ros::Msg
Gary Servin 0:04ac6be8229a 16 {
Gary Servin 0:04ac6be8229a 17 public:
Gary Servin 0:04ac6be8229a 18 typedef geometry_msgs::PoseStamped _start_type;
Gary Servin 0:04ac6be8229a 19 _start_type start;
Gary Servin 0:04ac6be8229a 20 typedef geometry_msgs::PoseStamped _goal_type;
Gary Servin 0:04ac6be8229a 21 _goal_type goal;
Gary Servin 0:04ac6be8229a 22 typedef float _tolerance_type;
Gary Servin 0:04ac6be8229a 23 _tolerance_type tolerance;
Gary Servin 0:04ac6be8229a 24
Gary Servin 0:04ac6be8229a 25 GetPlanRequest():
Gary Servin 0:04ac6be8229a 26 start(),
Gary Servin 0:04ac6be8229a 27 goal(),
Gary Servin 0:04ac6be8229a 28 tolerance(0)
Gary Servin 0:04ac6be8229a 29 {
Gary Servin 0:04ac6be8229a 30 }
Gary Servin 0:04ac6be8229a 31
Gary Servin 0:04ac6be8229a 32 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 33 {
Gary Servin 0:04ac6be8229a 34 int offset = 0;
Gary Servin 0:04ac6be8229a 35 offset += this->start.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 36 offset += this->goal.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 37 union {
Gary Servin 0:04ac6be8229a 38 float real;
Gary Servin 0:04ac6be8229a 39 uint32_t base;
Gary Servin 0:04ac6be8229a 40 } u_tolerance;
Gary Servin 0:04ac6be8229a 41 u_tolerance.real = this->tolerance;
Gary Servin 0:04ac6be8229a 42 *(outbuffer + offset + 0) = (u_tolerance.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 43 *(outbuffer + offset + 1) = (u_tolerance.base >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 44 *(outbuffer + offset + 2) = (u_tolerance.base >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 45 *(outbuffer + offset + 3) = (u_tolerance.base >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 46 offset += sizeof(this->tolerance);
Gary Servin 0:04ac6be8229a 47 return offset;
Gary Servin 0:04ac6be8229a 48 }
Gary Servin 0:04ac6be8229a 49
Gary Servin 0:04ac6be8229a 50 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 51 {
Gary Servin 0:04ac6be8229a 52 int offset = 0;
Gary Servin 0:04ac6be8229a 53 offset += this->start.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 54 offset += this->goal.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 55 union {
Gary Servin 0:04ac6be8229a 56 float real;
Gary Servin 0:04ac6be8229a 57 uint32_t base;
Gary Servin 0:04ac6be8229a 58 } u_tolerance;
Gary Servin 0:04ac6be8229a 59 u_tolerance.base = 0;
Gary Servin 0:04ac6be8229a 60 u_tolerance.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 61 u_tolerance.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 62 u_tolerance.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 63 u_tolerance.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 64 this->tolerance = u_tolerance.real;
Gary Servin 0:04ac6be8229a 65 offset += sizeof(this->tolerance);
Gary Servin 0:04ac6be8229a 66 return offset;
Gary Servin 0:04ac6be8229a 67 }
Gary Servin 0:04ac6be8229a 68
Gary Servin 0:04ac6be8229a 69 const char * getType(){ return GETPLAN; };
Gary Servin 0:04ac6be8229a 70 const char * getMD5(){ return "e25a43e0752bcca599a8c2eef8282df8"; };
Gary Servin 0:04ac6be8229a 71
Gary Servin 0:04ac6be8229a 72 };
Gary Servin 0:04ac6be8229a 73
Gary Servin 0:04ac6be8229a 74 class GetPlanResponse : public ros::Msg
Gary Servin 0:04ac6be8229a 75 {
Gary Servin 0:04ac6be8229a 76 public:
Gary Servin 0:04ac6be8229a 77 typedef nav_msgs::Path _plan_type;
Gary Servin 0:04ac6be8229a 78 _plan_type plan;
Gary Servin 0:04ac6be8229a 79
Gary Servin 0:04ac6be8229a 80 GetPlanResponse():
Gary Servin 0:04ac6be8229a 81 plan()
Gary Servin 0:04ac6be8229a 82 {
Gary Servin 0:04ac6be8229a 83 }
Gary Servin 0:04ac6be8229a 84
Gary Servin 0:04ac6be8229a 85 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 86 {
Gary Servin 0:04ac6be8229a 87 int offset = 0;
Gary Servin 0:04ac6be8229a 88 offset += this->plan.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 89 return offset;
Gary Servin 0:04ac6be8229a 90 }
Gary Servin 0:04ac6be8229a 91
Gary Servin 0:04ac6be8229a 92 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 93 {
Gary Servin 0:04ac6be8229a 94 int offset = 0;
Gary Servin 0:04ac6be8229a 95 offset += this->plan.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 96 return offset;
Gary Servin 0:04ac6be8229a 97 }
Gary Servin 0:04ac6be8229a 98
Gary Servin 0:04ac6be8229a 99 const char * getType(){ return GETPLAN; };
Gary Servin 0:04ac6be8229a 100 const char * getMD5(){ return "0002bc113c0259d71f6cf8cbc9430e18"; };
Gary Servin 0:04ac6be8229a 101
Gary Servin 0:04ac6be8229a 102 };
Gary Servin 0:04ac6be8229a 103
Gary Servin 0:04ac6be8229a 104 class GetPlan {
Gary Servin 0:04ac6be8229a 105 public:
Gary Servin 0:04ac6be8229a 106 typedef GetPlanRequest Request;
Gary Servin 0:04ac6be8229a 107 typedef GetPlanResponse Response;
Gary Servin 0:04ac6be8229a 108 };
Gary Servin 0:04ac6be8229a 109
Gary Servin 0:04ac6be8229a 110 }
Gary Servin 0:04ac6be8229a 111 #endif