ros melodic library with custom message

Dependents:   Robot_team1_QEI_Douglas Robot_team1

Committer:
florine_van
Date:
Tue Dec 03 09:39:29 2019 +0000
Revision:
3:b964e3f71102
Parent:
0:020db18a476d
Clean code and remove unused lines

Who changed what in which revision?

UserRevisionLine numberNew contents of line
scarter1 0:020db18a476d 1 #ifndef _ROS_actionlib_TestRequestGoal_h
scarter1 0:020db18a476d 2 #define _ROS_actionlib_TestRequestGoal_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 "ros/duration.h"
scarter1 0:020db18a476d 9
scarter1 0:020db18a476d 10 namespace actionlib
scarter1 0:020db18a476d 11 {
scarter1 0:020db18a476d 12
scarter1 0:020db18a476d 13 class TestRequestGoal : public ros::Msg
scarter1 0:020db18a476d 14 {
scarter1 0:020db18a476d 15 public:
scarter1 0:020db18a476d 16 typedef int32_t _terminate_status_type;
scarter1 0:020db18a476d 17 _terminate_status_type terminate_status;
scarter1 0:020db18a476d 18 typedef bool _ignore_cancel_type;
scarter1 0:020db18a476d 19 _ignore_cancel_type ignore_cancel;
scarter1 0:020db18a476d 20 typedef const char* _result_text_type;
scarter1 0:020db18a476d 21 _result_text_type result_text;
scarter1 0:020db18a476d 22 typedef int32_t _the_result_type;
scarter1 0:020db18a476d 23 _the_result_type the_result;
scarter1 0:020db18a476d 24 typedef bool _is_simple_client_type;
scarter1 0:020db18a476d 25 _is_simple_client_type is_simple_client;
scarter1 0:020db18a476d 26 typedef ros::Duration _delay_accept_type;
scarter1 0:020db18a476d 27 _delay_accept_type delay_accept;
scarter1 0:020db18a476d 28 typedef ros::Duration _delay_terminate_type;
scarter1 0:020db18a476d 29 _delay_terminate_type delay_terminate;
scarter1 0:020db18a476d 30 typedef ros::Duration _pause_status_type;
scarter1 0:020db18a476d 31 _pause_status_type pause_status;
scarter1 0:020db18a476d 32 enum { TERMINATE_SUCCESS = 0 };
scarter1 0:020db18a476d 33 enum { TERMINATE_ABORTED = 1 };
scarter1 0:020db18a476d 34 enum { TERMINATE_REJECTED = 2 };
scarter1 0:020db18a476d 35 enum { TERMINATE_LOSE = 3 };
scarter1 0:020db18a476d 36 enum { TERMINATE_DROP = 4 };
scarter1 0:020db18a476d 37 enum { TERMINATE_EXCEPTION = 5 };
scarter1 0:020db18a476d 38
scarter1 0:020db18a476d 39 TestRequestGoal():
scarter1 0:020db18a476d 40 terminate_status(0),
scarter1 0:020db18a476d 41 ignore_cancel(0),
scarter1 0:020db18a476d 42 result_text(""),
scarter1 0:020db18a476d 43 the_result(0),
scarter1 0:020db18a476d 44 is_simple_client(0),
scarter1 0:020db18a476d 45 delay_accept(),
scarter1 0:020db18a476d 46 delay_terminate(),
scarter1 0:020db18a476d 47 pause_status()
scarter1 0:020db18a476d 48 {
scarter1 0:020db18a476d 49 }
scarter1 0:020db18a476d 50
scarter1 0:020db18a476d 51 virtual int serialize(unsigned char *outbuffer) const
scarter1 0:020db18a476d 52 {
scarter1 0:020db18a476d 53 int offset = 0;
scarter1 0:020db18a476d 54 union {
scarter1 0:020db18a476d 55 int32_t real;
scarter1 0:020db18a476d 56 uint32_t base;
scarter1 0:020db18a476d 57 } u_terminate_status;
scarter1 0:020db18a476d 58 u_terminate_status.real = this->terminate_status;
scarter1 0:020db18a476d 59 *(outbuffer + offset + 0) = (u_terminate_status.base >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 60 *(outbuffer + offset + 1) = (u_terminate_status.base >> (8 * 1)) & 0xFF;
scarter1 0:020db18a476d 61 *(outbuffer + offset + 2) = (u_terminate_status.base >> (8 * 2)) & 0xFF;
scarter1 0:020db18a476d 62 *(outbuffer + offset + 3) = (u_terminate_status.base >> (8 * 3)) & 0xFF;
scarter1 0:020db18a476d 63 offset += sizeof(this->terminate_status);
scarter1 0:020db18a476d 64 union {
scarter1 0:020db18a476d 65 bool real;
scarter1 0:020db18a476d 66 uint8_t base;
scarter1 0:020db18a476d 67 } u_ignore_cancel;
scarter1 0:020db18a476d 68 u_ignore_cancel.real = this->ignore_cancel;
scarter1 0:020db18a476d 69 *(outbuffer + offset + 0) = (u_ignore_cancel.base >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 70 offset += sizeof(this->ignore_cancel);
scarter1 0:020db18a476d 71 uint32_t length_result_text = strlen(this->result_text);
scarter1 0:020db18a476d 72 varToArr(outbuffer + offset, length_result_text);
scarter1 0:020db18a476d 73 offset += 4;
scarter1 0:020db18a476d 74 memcpy(outbuffer + offset, this->result_text, length_result_text);
scarter1 0:020db18a476d 75 offset += length_result_text;
scarter1 0:020db18a476d 76 union {
scarter1 0:020db18a476d 77 int32_t real;
scarter1 0:020db18a476d 78 uint32_t base;
scarter1 0:020db18a476d 79 } u_the_result;
scarter1 0:020db18a476d 80 u_the_result.real = this->the_result;
scarter1 0:020db18a476d 81 *(outbuffer + offset + 0) = (u_the_result.base >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 82 *(outbuffer + offset + 1) = (u_the_result.base >> (8 * 1)) & 0xFF;
scarter1 0:020db18a476d 83 *(outbuffer + offset + 2) = (u_the_result.base >> (8 * 2)) & 0xFF;
scarter1 0:020db18a476d 84 *(outbuffer + offset + 3) = (u_the_result.base >> (8 * 3)) & 0xFF;
scarter1 0:020db18a476d 85 offset += sizeof(this->the_result);
scarter1 0:020db18a476d 86 union {
scarter1 0:020db18a476d 87 bool real;
scarter1 0:020db18a476d 88 uint8_t base;
scarter1 0:020db18a476d 89 } u_is_simple_client;
scarter1 0:020db18a476d 90 u_is_simple_client.real = this->is_simple_client;
scarter1 0:020db18a476d 91 *(outbuffer + offset + 0) = (u_is_simple_client.base >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 92 offset += sizeof(this->is_simple_client);
scarter1 0:020db18a476d 93 *(outbuffer + offset + 0) = (this->delay_accept.sec >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 94 *(outbuffer + offset + 1) = (this->delay_accept.sec >> (8 * 1)) & 0xFF;
scarter1 0:020db18a476d 95 *(outbuffer + offset + 2) = (this->delay_accept.sec >> (8 * 2)) & 0xFF;
scarter1 0:020db18a476d 96 *(outbuffer + offset + 3) = (this->delay_accept.sec >> (8 * 3)) & 0xFF;
scarter1 0:020db18a476d 97 offset += sizeof(this->delay_accept.sec);
scarter1 0:020db18a476d 98 *(outbuffer + offset + 0) = (this->delay_accept.nsec >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 99 *(outbuffer + offset + 1) = (this->delay_accept.nsec >> (8 * 1)) & 0xFF;
scarter1 0:020db18a476d 100 *(outbuffer + offset + 2) = (this->delay_accept.nsec >> (8 * 2)) & 0xFF;
scarter1 0:020db18a476d 101 *(outbuffer + offset + 3) = (this->delay_accept.nsec >> (8 * 3)) & 0xFF;
scarter1 0:020db18a476d 102 offset += sizeof(this->delay_accept.nsec);
scarter1 0:020db18a476d 103 *(outbuffer + offset + 0) = (this->delay_terminate.sec >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 104 *(outbuffer + offset + 1) = (this->delay_terminate.sec >> (8 * 1)) & 0xFF;
scarter1 0:020db18a476d 105 *(outbuffer + offset + 2) = (this->delay_terminate.sec >> (8 * 2)) & 0xFF;
scarter1 0:020db18a476d 106 *(outbuffer + offset + 3) = (this->delay_terminate.sec >> (8 * 3)) & 0xFF;
scarter1 0:020db18a476d 107 offset += sizeof(this->delay_terminate.sec);
scarter1 0:020db18a476d 108 *(outbuffer + offset + 0) = (this->delay_terminate.nsec >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 109 *(outbuffer + offset + 1) = (this->delay_terminate.nsec >> (8 * 1)) & 0xFF;
scarter1 0:020db18a476d 110 *(outbuffer + offset + 2) = (this->delay_terminate.nsec >> (8 * 2)) & 0xFF;
scarter1 0:020db18a476d 111 *(outbuffer + offset + 3) = (this->delay_terminate.nsec >> (8 * 3)) & 0xFF;
scarter1 0:020db18a476d 112 offset += sizeof(this->delay_terminate.nsec);
scarter1 0:020db18a476d 113 *(outbuffer + offset + 0) = (this->pause_status.sec >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 114 *(outbuffer + offset + 1) = (this->pause_status.sec >> (8 * 1)) & 0xFF;
scarter1 0:020db18a476d 115 *(outbuffer + offset + 2) = (this->pause_status.sec >> (8 * 2)) & 0xFF;
scarter1 0:020db18a476d 116 *(outbuffer + offset + 3) = (this->pause_status.sec >> (8 * 3)) & 0xFF;
scarter1 0:020db18a476d 117 offset += sizeof(this->pause_status.sec);
scarter1 0:020db18a476d 118 *(outbuffer + offset + 0) = (this->pause_status.nsec >> (8 * 0)) & 0xFF;
scarter1 0:020db18a476d 119 *(outbuffer + offset + 1) = (this->pause_status.nsec >> (8 * 1)) & 0xFF;
scarter1 0:020db18a476d 120 *(outbuffer + offset + 2) = (this->pause_status.nsec >> (8 * 2)) & 0xFF;
scarter1 0:020db18a476d 121 *(outbuffer + offset + 3) = (this->pause_status.nsec >> (8 * 3)) & 0xFF;
scarter1 0:020db18a476d 122 offset += sizeof(this->pause_status.nsec);
scarter1 0:020db18a476d 123 return offset;
scarter1 0:020db18a476d 124 }
scarter1 0:020db18a476d 125
scarter1 0:020db18a476d 126 virtual int deserialize(unsigned char *inbuffer)
scarter1 0:020db18a476d 127 {
scarter1 0:020db18a476d 128 int offset = 0;
scarter1 0:020db18a476d 129 union {
scarter1 0:020db18a476d 130 int32_t real;
scarter1 0:020db18a476d 131 uint32_t base;
scarter1 0:020db18a476d 132 } u_terminate_status;
scarter1 0:020db18a476d 133 u_terminate_status.base = 0;
scarter1 0:020db18a476d 134 u_terminate_status.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
scarter1 0:020db18a476d 135 u_terminate_status.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
scarter1 0:020db18a476d 136 u_terminate_status.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
scarter1 0:020db18a476d 137 u_terminate_status.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
scarter1 0:020db18a476d 138 this->terminate_status = u_terminate_status.real;
scarter1 0:020db18a476d 139 offset += sizeof(this->terminate_status);
scarter1 0:020db18a476d 140 union {
scarter1 0:020db18a476d 141 bool real;
scarter1 0:020db18a476d 142 uint8_t base;
scarter1 0:020db18a476d 143 } u_ignore_cancel;
scarter1 0:020db18a476d 144 u_ignore_cancel.base = 0;
scarter1 0:020db18a476d 145 u_ignore_cancel.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
scarter1 0:020db18a476d 146 this->ignore_cancel = u_ignore_cancel.real;
scarter1 0:020db18a476d 147 offset += sizeof(this->ignore_cancel);
scarter1 0:020db18a476d 148 uint32_t length_result_text;
scarter1 0:020db18a476d 149 arrToVar(length_result_text, (inbuffer + offset));
scarter1 0:020db18a476d 150 offset += 4;
scarter1 0:020db18a476d 151 for(unsigned int k= offset; k< offset+length_result_text; ++k){
scarter1 0:020db18a476d 152 inbuffer[k-1]=inbuffer[k];
scarter1 0:020db18a476d 153 }
scarter1 0:020db18a476d 154 inbuffer[offset+length_result_text-1]=0;
scarter1 0:020db18a476d 155 this->result_text = (char *)(inbuffer + offset-1);
scarter1 0:020db18a476d 156 offset += length_result_text;
scarter1 0:020db18a476d 157 union {
scarter1 0:020db18a476d 158 int32_t real;
scarter1 0:020db18a476d 159 uint32_t base;
scarter1 0:020db18a476d 160 } u_the_result;
scarter1 0:020db18a476d 161 u_the_result.base = 0;
scarter1 0:020db18a476d 162 u_the_result.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
scarter1 0:020db18a476d 163 u_the_result.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
scarter1 0:020db18a476d 164 u_the_result.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
scarter1 0:020db18a476d 165 u_the_result.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
scarter1 0:020db18a476d 166 this->the_result = u_the_result.real;
scarter1 0:020db18a476d 167 offset += sizeof(this->the_result);
scarter1 0:020db18a476d 168 union {
scarter1 0:020db18a476d 169 bool real;
scarter1 0:020db18a476d 170 uint8_t base;
scarter1 0:020db18a476d 171 } u_is_simple_client;
scarter1 0:020db18a476d 172 u_is_simple_client.base = 0;
scarter1 0:020db18a476d 173 u_is_simple_client.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
scarter1 0:020db18a476d 174 this->is_simple_client = u_is_simple_client.real;
scarter1 0:020db18a476d 175 offset += sizeof(this->is_simple_client);
scarter1 0:020db18a476d 176 this->delay_accept.sec = ((uint32_t) (*(inbuffer + offset)));
scarter1 0:020db18a476d 177 this->delay_accept.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
scarter1 0:020db18a476d 178 this->delay_accept.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
scarter1 0:020db18a476d 179 this->delay_accept.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
scarter1 0:020db18a476d 180 offset += sizeof(this->delay_accept.sec);
scarter1 0:020db18a476d 181 this->delay_accept.nsec = ((uint32_t) (*(inbuffer + offset)));
scarter1 0:020db18a476d 182 this->delay_accept.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
scarter1 0:020db18a476d 183 this->delay_accept.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
scarter1 0:020db18a476d 184 this->delay_accept.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
scarter1 0:020db18a476d 185 offset += sizeof(this->delay_accept.nsec);
scarter1 0:020db18a476d 186 this->delay_terminate.sec = ((uint32_t) (*(inbuffer + offset)));
scarter1 0:020db18a476d 187 this->delay_terminate.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
scarter1 0:020db18a476d 188 this->delay_terminate.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
scarter1 0:020db18a476d 189 this->delay_terminate.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
scarter1 0:020db18a476d 190 offset += sizeof(this->delay_terminate.sec);
scarter1 0:020db18a476d 191 this->delay_terminate.nsec = ((uint32_t) (*(inbuffer + offset)));
scarter1 0:020db18a476d 192 this->delay_terminate.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
scarter1 0:020db18a476d 193 this->delay_terminate.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
scarter1 0:020db18a476d 194 this->delay_terminate.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
scarter1 0:020db18a476d 195 offset += sizeof(this->delay_terminate.nsec);
scarter1 0:020db18a476d 196 this->pause_status.sec = ((uint32_t) (*(inbuffer + offset)));
scarter1 0:020db18a476d 197 this->pause_status.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
scarter1 0:020db18a476d 198 this->pause_status.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
scarter1 0:020db18a476d 199 this->pause_status.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
scarter1 0:020db18a476d 200 offset += sizeof(this->pause_status.sec);
scarter1 0:020db18a476d 201 this->pause_status.nsec = ((uint32_t) (*(inbuffer + offset)));
scarter1 0:020db18a476d 202 this->pause_status.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
scarter1 0:020db18a476d 203 this->pause_status.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
scarter1 0:020db18a476d 204 this->pause_status.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
scarter1 0:020db18a476d 205 offset += sizeof(this->pause_status.nsec);
scarter1 0:020db18a476d 206 return offset;
scarter1 0:020db18a476d 207 }
scarter1 0:020db18a476d 208
scarter1 0:020db18a476d 209 const char * getType(){ return "actionlib/TestRequestGoal"; };
scarter1 0:020db18a476d 210 const char * getMD5(){ return "db5d00ba98302d6c6dd3737e9a03ceea"; };
scarter1 0:020db18a476d 211
scarter1 0:020db18a476d 212 };
scarter1 0:020db18a476d 213
scarter1 0:020db18a476d 214 }
scarter1 0:020db18a476d 215 #endif