Just changed OUTPUT_SIZE and INPUT_SIZE in ros/node_handle.h

Dependencies:   BufferedSerial

Dependents:   WRS2020_mecanum_node

Committer:
sgrsn
Date:
Mon Nov 02 09:00:01 2020 +0000
Revision:
2:5d429be7d0aa
Parent:
0:04ac6be8229a
Change INPUT_SIZE and OUTPUT_SIZE on node_handle.h to pub sub

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gary Servin 0:04ac6be8229a 1 #ifndef _ROS_SERVICE_SetPen_h
Gary Servin 0:04ac6be8229a 2 #define _ROS_SERVICE_SetPen_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
Gary Servin 0:04ac6be8229a 8 namespace turtlesim
Gary Servin 0:04ac6be8229a 9 {
Gary Servin 0:04ac6be8229a 10
Gary Servin 0:04ac6be8229a 11 static const char SETPEN[] = "turtlesim/SetPen";
Gary Servin 0:04ac6be8229a 12
Gary Servin 0:04ac6be8229a 13 class SetPenRequest : public ros::Msg
Gary Servin 0:04ac6be8229a 14 {
Gary Servin 0:04ac6be8229a 15 public:
Gary Servin 0:04ac6be8229a 16 typedef uint8_t _r_type;
Gary Servin 0:04ac6be8229a 17 _r_type r;
Gary Servin 0:04ac6be8229a 18 typedef uint8_t _g_type;
Gary Servin 0:04ac6be8229a 19 _g_type g;
Gary Servin 0:04ac6be8229a 20 typedef uint8_t _b_type;
Gary Servin 0:04ac6be8229a 21 _b_type b;
Gary Servin 0:04ac6be8229a 22 typedef uint8_t _width_type;
Gary Servin 0:04ac6be8229a 23 _width_type width;
Gary Servin 0:04ac6be8229a 24 typedef uint8_t _off_type;
Gary Servin 0:04ac6be8229a 25 _off_type off;
Gary Servin 0:04ac6be8229a 26
Gary Servin 0:04ac6be8229a 27 SetPenRequest():
Gary Servin 0:04ac6be8229a 28 r(0),
Gary Servin 0:04ac6be8229a 29 g(0),
Gary Servin 0:04ac6be8229a 30 b(0),
Gary Servin 0:04ac6be8229a 31 width(0),
Gary Servin 0:04ac6be8229a 32 off(0)
Gary Servin 0:04ac6be8229a 33 {
Gary Servin 0:04ac6be8229a 34 }
Gary Servin 0:04ac6be8229a 35
Gary Servin 0:04ac6be8229a 36 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 37 {
Gary Servin 0:04ac6be8229a 38 int offset = 0;
Gary Servin 0:04ac6be8229a 39 *(outbuffer + offset + 0) = (this->r >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 40 offset += sizeof(this->r);
Gary Servin 0:04ac6be8229a 41 *(outbuffer + offset + 0) = (this->g >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 42 offset += sizeof(this->g);
Gary Servin 0:04ac6be8229a 43 *(outbuffer + offset + 0) = (this->b >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 44 offset += sizeof(this->b);
Gary Servin 0:04ac6be8229a 45 *(outbuffer + offset + 0) = (this->width >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 46 offset += sizeof(this->width);
Gary Servin 0:04ac6be8229a 47 *(outbuffer + offset + 0) = (this->off >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 48 offset += sizeof(this->off);
Gary Servin 0:04ac6be8229a 49 return offset;
Gary Servin 0:04ac6be8229a 50 }
Gary Servin 0:04ac6be8229a 51
Gary Servin 0:04ac6be8229a 52 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 53 {
Gary Servin 0:04ac6be8229a 54 int offset = 0;
Gary Servin 0:04ac6be8229a 55 this->r = ((uint8_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 56 offset += sizeof(this->r);
Gary Servin 0:04ac6be8229a 57 this->g = ((uint8_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 58 offset += sizeof(this->g);
Gary Servin 0:04ac6be8229a 59 this->b = ((uint8_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 60 offset += sizeof(this->b);
Gary Servin 0:04ac6be8229a 61 this->width = ((uint8_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 62 offset += sizeof(this->width);
Gary Servin 0:04ac6be8229a 63 this->off = ((uint8_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 64 offset += sizeof(this->off);
Gary Servin 0:04ac6be8229a 65 return offset;
Gary Servin 0:04ac6be8229a 66 }
Gary Servin 0:04ac6be8229a 67
Gary Servin 0:04ac6be8229a 68 const char * getType(){ return SETPEN; };
Gary Servin 0:04ac6be8229a 69 const char * getMD5(){ return "9f452acce566bf0c0954594f69a8e41b"; };
Gary Servin 0:04ac6be8229a 70
Gary Servin 0:04ac6be8229a 71 };
Gary Servin 0:04ac6be8229a 72
Gary Servin 0:04ac6be8229a 73 class SetPenResponse : public ros::Msg
Gary Servin 0:04ac6be8229a 74 {
Gary Servin 0:04ac6be8229a 75 public:
Gary Servin 0:04ac6be8229a 76
Gary Servin 0:04ac6be8229a 77 SetPenResponse()
Gary Servin 0:04ac6be8229a 78 {
Gary Servin 0:04ac6be8229a 79 }
Gary Servin 0:04ac6be8229a 80
Gary Servin 0:04ac6be8229a 81 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 82 {
Gary Servin 0:04ac6be8229a 83 int offset = 0;
Gary Servin 0:04ac6be8229a 84 return offset;
Gary Servin 0:04ac6be8229a 85 }
Gary Servin 0:04ac6be8229a 86
Gary Servin 0:04ac6be8229a 87 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 88 {
Gary Servin 0:04ac6be8229a 89 int offset = 0;
Gary Servin 0:04ac6be8229a 90 return offset;
Gary Servin 0:04ac6be8229a 91 }
Gary Servin 0:04ac6be8229a 92
Gary Servin 0:04ac6be8229a 93 const char * getType(){ return SETPEN; };
Gary Servin 0:04ac6be8229a 94 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
Gary Servin 0:04ac6be8229a 95
Gary Servin 0:04ac6be8229a 96 };
Gary Servin 0:04ac6be8229a 97
Gary Servin 0:04ac6be8229a 98 class SetPen {
Gary Servin 0:04ac6be8229a 99 public:
Gary Servin 0:04ac6be8229a 100 typedef SetPenRequest Request;
Gary Servin 0:04ac6be8229a 101 typedef SetPenResponse Response;
Gary Servin 0:04ac6be8229a 102 };
Gary Servin 0:04ac6be8229a 103
Gary Servin 0:04ac6be8229a 104 }
Gary Servin 0:04ac6be8229a 105 #endif