catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ErrorCode.h Source File

ErrorCode.h

00001 #ifndef _ROS_catchrobo_msgs_ErrorCode_h
00002 #define _ROS_catchrobo_msgs_ErrorCode_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace catchrobo_msgs
00010 {
00011 
00012   class ErrorCode : public ros::Msg
00013   {
00014     public:
00015       typedef uint8_t _id_type;
00016       _id_type id;
00017       typedef uint8_t _error_code_type;
00018       _error_code_type error_code;
00019       enum { NONE = 0 };
00020       enum { OVER_POSITION = 1 };
00021       enum { OVER_VELOCITY = 2 };
00022       enum { OVER_TORQUE = 3 };
00023       enum { FAR_TARGET_POSITION = 4 };
00024       enum { COLLISION = 5 };
00025       enum { FINISH =  6 };
00026 
00027     ErrorCode():
00028       id(0),
00029       error_code(0)
00030     {
00031     }
00032 
00033     virtual int serialize(unsigned char *outbuffer) const
00034     {
00035       int offset = 0;
00036       *(outbuffer + offset + 0) = (this->id >> (8 * 0)) & 0xFF;
00037       offset += sizeof(this->id);
00038       *(outbuffer + offset + 0) = (this->error_code >> (8 * 0)) & 0xFF;
00039       offset += sizeof(this->error_code);
00040       return offset;
00041     }
00042 
00043     virtual int deserialize(unsigned char *inbuffer)
00044     {
00045       int offset = 0;
00046       this->id =  ((uint8_t) (*(inbuffer + offset)));
00047       offset += sizeof(this->id);
00048       this->error_code =  ((uint8_t) (*(inbuffer + offset)));
00049       offset += sizeof(this->error_code);
00050      return offset;
00051     }
00052 
00053     virtual const char * getType(){ return "catchrobo_msgs/ErrorCode"; };
00054     virtual const char * getMD5(){ return "aceee3091e1a045dee8a6a3039036673"; };
00055 
00056   };
00057 
00058 }
00059 #endif