ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

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       int32_t error_code;
00016       const char* error_string;
00017       enum { SUCCESSFUL =  0 };
00018       enum { INVALID_GOAL =  -1 };
00019       enum { INVALID_JOINTS =  -2 };
00020       enum { OLD_HEADER_TIMESTAMP =  -3 };
00021       enum { PATH_TOLERANCE_VIOLATED =  -4 };
00022       enum { GOAL_TOLERANCE_VIOLATED =  -5 };
00023 
00024     FollowJointTrajectoryResult():
00025       error_code(0),
00026       error_string("")
00027     {
00028     }
00029 
00030     virtual int serialize(unsigned char *outbuffer) const
00031     {
00032       int offset = 0;
00033       union {
00034         int32_t real;
00035         uint32_t base;
00036       } u_error_code;
00037       u_error_code.real = this->error_code;
00038       *(outbuffer + offset + 0) = (u_error_code.base >> (8 * 0)) & 0xFF;
00039       *(outbuffer + offset + 1) = (u_error_code.base >> (8 * 1)) & 0xFF;
00040       *(outbuffer + offset + 2) = (u_error_code.base >> (8 * 2)) & 0xFF;
00041       *(outbuffer + offset + 3) = (u_error_code.base >> (8 * 3)) & 0xFF;
00042       offset += sizeof(this->error_code);
00043       uint32_t length_error_string = strlen(this->error_string);
00044       memcpy(outbuffer + offset, &length_error_string, sizeof(uint32_t));
00045       offset += 4;
00046       memcpy(outbuffer + offset, this->error_string, length_error_string);
00047       offset += length_error_string;
00048       return offset;
00049     }
00050 
00051     virtual int deserialize(unsigned char *inbuffer)
00052     {
00053       int offset = 0;
00054       union {
00055         int32_t real;
00056         uint32_t base;
00057       } u_error_code;
00058       u_error_code.base = 0;
00059       u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00060       u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00061       u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00062       u_error_code.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00063       this->error_code = u_error_code.real;
00064       offset += sizeof(this->error_code);
00065       uint32_t length_error_string;
00066       memcpy(&length_error_string, (inbuffer + offset), sizeof(uint32_t));
00067       offset += 4;
00068       for(unsigned int k= offset; k< offset+length_error_string; ++k){
00069           inbuffer[k-1]=inbuffer[k];
00070       }
00071       inbuffer[offset+length_error_string-1]=0;
00072       this->error_string = (char *)(inbuffer + offset-1);
00073       offset += length_error_string;
00074      return offset;
00075     }
00076 
00077     const char * getType(){ return "control_msgs/FollowJointTrajectoryResult"; };
00078     const char * getMD5(){ return "493383b18409bfb604b4e26c676401d2"; };
00079 
00080   };
00081 
00082 }
00083 #endif