hairo

Dependencies:   mbed BufferedSerial

Committer:
tknara
Date:
Tue Dec 04 00:14:32 2018 +0000
Revision:
4:bcdd99711326
Parent:
0:9e9b7db60fd5
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_tf2_msgs_TF2Error_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_tf2_msgs_TF2Error_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8
garyservin 0:9e9b7db60fd5 9 namespace tf2_msgs
garyservin 0:9e9b7db60fd5 10 {
garyservin 0:9e9b7db60fd5 11
garyservin 0:9e9b7db60fd5 12 class TF2Error : public ros::Msg
garyservin 0:9e9b7db60fd5 13 {
garyservin 0:9e9b7db60fd5 14 public:
garyservin 0:9e9b7db60fd5 15 typedef uint8_t _error_type;
garyservin 0:9e9b7db60fd5 16 _error_type error;
garyservin 0:9e9b7db60fd5 17 typedef const char* _error_string_type;
garyservin 0:9e9b7db60fd5 18 _error_string_type error_string;
garyservin 0:9e9b7db60fd5 19 enum { NO_ERROR = 0 };
garyservin 0:9e9b7db60fd5 20 enum { LOOKUP_ERROR = 1 };
garyservin 0:9e9b7db60fd5 21 enum { CONNECTIVITY_ERROR = 2 };
garyservin 0:9e9b7db60fd5 22 enum { EXTRAPOLATION_ERROR = 3 };
garyservin 0:9e9b7db60fd5 23 enum { INVALID_ARGUMENT_ERROR = 4 };
garyservin 0:9e9b7db60fd5 24 enum { TIMEOUT_ERROR = 5 };
garyservin 0:9e9b7db60fd5 25 enum { TRANSFORM_ERROR = 6 };
garyservin 0:9e9b7db60fd5 26
garyservin 0:9e9b7db60fd5 27 TF2Error():
garyservin 0:9e9b7db60fd5 28 error(0),
garyservin 0:9e9b7db60fd5 29 error_string("")
garyservin 0:9e9b7db60fd5 30 {
garyservin 0:9e9b7db60fd5 31 }
garyservin 0:9e9b7db60fd5 32
garyservin 0:9e9b7db60fd5 33 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 34 {
garyservin 0:9e9b7db60fd5 35 int offset = 0;
garyservin 0:9e9b7db60fd5 36 *(outbuffer + offset + 0) = (this->error >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 37 offset += sizeof(this->error);
garyservin 0:9e9b7db60fd5 38 uint32_t length_error_string = strlen(this->error_string);
garyservin 0:9e9b7db60fd5 39 varToArr(outbuffer + offset, length_error_string);
garyservin 0:9e9b7db60fd5 40 offset += 4;
garyservin 0:9e9b7db60fd5 41 memcpy(outbuffer + offset, this->error_string, length_error_string);
garyservin 0:9e9b7db60fd5 42 offset += length_error_string;
garyservin 0:9e9b7db60fd5 43 return offset;
garyservin 0:9e9b7db60fd5 44 }
garyservin 0:9e9b7db60fd5 45
garyservin 0:9e9b7db60fd5 46 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 47 {
garyservin 0:9e9b7db60fd5 48 int offset = 0;
garyservin 0:9e9b7db60fd5 49 this->error = ((uint8_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 50 offset += sizeof(this->error);
garyservin 0:9e9b7db60fd5 51 uint32_t length_error_string;
garyservin 0:9e9b7db60fd5 52 arrToVar(length_error_string, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 53 offset += 4;
garyservin 0:9e9b7db60fd5 54 for(unsigned int k= offset; k< offset+length_error_string; ++k){
garyservin 0:9e9b7db60fd5 55 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 56 }
garyservin 0:9e9b7db60fd5 57 inbuffer[offset+length_error_string-1]=0;
garyservin 0:9e9b7db60fd5 58 this->error_string = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 59 offset += length_error_string;
garyservin 0:9e9b7db60fd5 60 return offset;
garyservin 0:9e9b7db60fd5 61 }
garyservin 0:9e9b7db60fd5 62
garyservin 0:9e9b7db60fd5 63 const char * getType(){ return "tf2_msgs/TF2Error"; };
garyservin 0:9e9b7db60fd5 64 const char * getMD5(){ return "bc6848fd6fd750c92e38575618a4917d"; };
garyservin 0:9e9b7db60fd5 65
garyservin 0:9e9b7db60fd5 66 };
garyservin 0:9e9b7db60fd5 67
garyservin 0:9e9b7db60fd5 68 }
garyservin 0:9e9b7db60fd5 69 #endif