Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FollowJointTrajectoryResult.h Source File

FollowJointTrajectoryResult.h

00001 #ifndef _ROS_control_msgs_FollowJointTrajectoryResult_h
00002 #define _ROS_control_msgs_FollowJointTrajectoryResult_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace control_msgs
00010 {
00011 
00012   class FollowJointTrajectoryResult : public ros::Msg
00013   {
00014     public:
00015       typedef int32_t _error_code_type;
00016       _error_code_type error_code;
00017       typedef const char* _error_string_type;
00018       _error_string_type error_string;
00019       enum { SUCCESSFUL =  0 };
00020       enum { INVALID_GOAL =  -1 };
00021       enum { INVALID_JOINTS =  -2 };
00022       enum { OLD_HEADER_TIMESTAMP =  -3 };
00023       enum { PATH_TOLERANCE_VIOLATED =  -4 };
00024       enum { GOAL_TOLERANCE_VIOLATED =  -5 };
00025 
00026     FollowJointTrajectoryResult():
00027       error_code(0),
00028       error_string("")
00029     {
00030     }
00031 
00032     virtual int serialize(unsigned char *outbuffer) const
00033     {
00034       int offset = 0;
00035       union {
00036         int32_t real;
00037         uint32_t base;
00038       } u_error_code;
00039       u_error_code.real = this->error_code;
00040       *(outbuffer + offset + 0) = (u_error_code.base >> (8 * 0)) & 0xFF;
00041       *(outbuffer + offset + 1) = (u_error_code.base >> (8 * 1)) & 0xFF;
00042       *(outbuffer + offset + 2) = (u_error_code.base >> (8 * 2)) & 0xFF;
00043       *(outbuffer + offset + 3) = (u_error_code.base >> (8 * 3)) & 0xFF;
00044       offset += sizeof(this->error_code);
00045       uint32_t length_error_string = strlen(this->error_string);
00046       varToArr(outbuffer + offset, length_error_string);
00047       offset += 4;
00048       memcpy(outbuffer + offset, this->error_string, length_error_string);
00049       offset += length_error_string;
00050       return offset;
00051     }
00052 
00053     virtual int deserialize(unsigned char *inbuffer)
00054     {
00055       int offset = 0;
00056       union {
00057         int32_t real;
00058         uint32_t base;
00059       } u_error_code;
00060       u_error_code.base = 0;
00061       u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00062       u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00063       u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00064       u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00065       this->error_code = u_error_code.real;
00066       offset += sizeof(this->error_code);
00067       uint32_t length_error_string;
00068       arrToVar(length_error_string, (inbuffer + offset));
00069       offset += 4;
00070       for(unsigned int k= offset; k< offset+length_error_string; ++k){
00071           inbuffer[k-1]=inbuffer[k];
00072       }
00073       inbuffer[offset+length_error_string-1]=0;
00074       this->error_string = (char *)(inbuffer + offset-1);
00075       offset += length_error_string;
00076      return offset;
00077     }
00078 
00079     const char * getType(){ return "control_msgs/FollowJointTrajectoryResult"; };
00080     const char * getMD5(){ return "493383b18409bfb604b4e26c676401d2"; };
00081 
00082   };
00083 
00084 }
00085 #endif