catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SaveRobotStateToWarehouse.h Source File

SaveRobotStateToWarehouse.h

00001 #ifndef _ROS_SERVICE_SaveRobotStateToWarehouse_h
00002 #define _ROS_SERVICE_SaveRobotStateToWarehouse_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "moveit_msgs/RobotState.h"
00008 
00009 namespace moveit_msgs
00010 {
00011 
00012 static const char SAVEROBOTSTATETOWAREHOUSE[] = "moveit_msgs/SaveRobotStateToWarehouse";
00013 
00014   class SaveRobotStateToWarehouseRequest : public ros::Msg
00015   {
00016     public:
00017       typedef const char* _name_type;
00018       _name_type name;
00019       typedef const char* _robot_type;
00020       _robot_type robot;
00021       typedef moveit_msgs::RobotState _state_type;
00022       _state_type state;
00023 
00024     SaveRobotStateToWarehouseRequest():
00025       name(""),
00026       robot(""),
00027       state()
00028     {
00029     }
00030 
00031     virtual int serialize(unsigned char *outbuffer) const
00032     {
00033       int offset = 0;
00034       uint32_t length_name = strlen(this->name);
00035       varToArr(outbuffer + offset, length_name);
00036       offset += 4;
00037       memcpy(outbuffer + offset, this->name, length_name);
00038       offset += length_name;
00039       uint32_t length_robot = strlen(this->robot);
00040       varToArr(outbuffer + offset, length_robot);
00041       offset += 4;
00042       memcpy(outbuffer + offset, this->robot, length_robot);
00043       offset += length_robot;
00044       offset += this->state.serialize(outbuffer + offset);
00045       return offset;
00046     }
00047 
00048     virtual int deserialize(unsigned char *inbuffer)
00049     {
00050       int offset = 0;
00051       uint32_t length_name;
00052       arrToVar(length_name, (inbuffer + offset));
00053       offset += 4;
00054       for(unsigned int k= offset; k< offset+length_name; ++k){
00055           inbuffer[k-1]=inbuffer[k];
00056       }
00057       inbuffer[offset+length_name-1]=0;
00058       this->name = (char *)(inbuffer + offset-1);
00059       offset += length_name;
00060       uint32_t length_robot;
00061       arrToVar(length_robot, (inbuffer + offset));
00062       offset += 4;
00063       for(unsigned int k= offset; k< offset+length_robot; ++k){
00064           inbuffer[k-1]=inbuffer[k];
00065       }
00066       inbuffer[offset+length_robot-1]=0;
00067       this->robot = (char *)(inbuffer + offset-1);
00068       offset += length_robot;
00069       offset += this->state.deserialize(inbuffer + offset);
00070      return offset;
00071     }
00072 
00073     virtual const char * getType(){ return SAVEROBOTSTATETOWAREHOUSE; };
00074     virtual const char * getMD5(){ return "7937284880c511876f85988912ec5448"; };
00075 
00076   };
00077 
00078   class SaveRobotStateToWarehouseResponse : public ros::Msg
00079   {
00080     public:
00081       typedef bool _success_type;
00082       _success_type success;
00083 
00084     SaveRobotStateToWarehouseResponse():
00085       success(0)
00086     {
00087     }
00088 
00089     virtual int serialize(unsigned char *outbuffer) const
00090     {
00091       int offset = 0;
00092       union {
00093         bool real;
00094         uint8_t base;
00095       } u_success;
00096       u_success.real = this->success;
00097       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00098       offset += sizeof(this->success);
00099       return offset;
00100     }
00101 
00102     virtual int deserialize(unsigned char *inbuffer)
00103     {
00104       int offset = 0;
00105       union {
00106         bool real;
00107         uint8_t base;
00108       } u_success;
00109       u_success.base = 0;
00110       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00111       this->success = u_success.real;
00112       offset += sizeof(this->success);
00113      return offset;
00114     }
00115 
00116     virtual const char * getType(){ return SAVEROBOTSTATETOWAREHOUSE; };
00117     virtual const char * getMD5(){ return "358e233cde0c8a8bcfea4ce193f8fc15"; };
00118 
00119   };
00120 
00121   class SaveRobotStateToWarehouse {
00122     public:
00123     typedef SaveRobotStateToWarehouseRequest Request;
00124     typedef SaveRobotStateToWarehouseResponse Response;
00125   };
00126 
00127 }
00128 #endif