catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PickupResult.h Source File

PickupResult.h

00001 #ifndef _ROS_moveit_msgs_PickupResult_h
00002 #define _ROS_moveit_msgs_PickupResult_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "moveit_msgs/MoveItErrorCodes.h"
00009 #include "moveit_msgs/RobotState.h"
00010 #include "moveit_msgs/RobotTrajectory.h"
00011 #include "moveit_msgs/Grasp.h"
00012 
00013 namespace moveit_msgs
00014 {
00015 
00016   class PickupResult : public ros::Msg
00017   {
00018     public:
00019       typedef moveit_msgs::MoveItErrorCodes _error_code_type;
00020       _error_code_type error_code;
00021       typedef moveit_msgs::RobotState _trajectory_start_type;
00022       _trajectory_start_type trajectory_start;
00023       uint32_t trajectory_stages_length;
00024       typedef moveit_msgs::RobotTrajectory _trajectory_stages_type;
00025       _trajectory_stages_type st_trajectory_stages;
00026       _trajectory_stages_type * trajectory_stages;
00027       uint32_t trajectory_descriptions_length;
00028       typedef char* _trajectory_descriptions_type;
00029       _trajectory_descriptions_type st_trajectory_descriptions;
00030       _trajectory_descriptions_type * trajectory_descriptions;
00031       typedef moveit_msgs::Grasp _grasp_type;
00032       _grasp_type grasp;
00033       typedef double _planning_time_type;
00034       _planning_time_type planning_time;
00035 
00036     PickupResult():
00037       error_code(),
00038       trajectory_start(),
00039       trajectory_stages_length(0), trajectory_stages(NULL),
00040       trajectory_descriptions_length(0), trajectory_descriptions(NULL),
00041       grasp(),
00042       planning_time(0)
00043     {
00044     }
00045 
00046     virtual int serialize(unsigned char *outbuffer) const
00047     {
00048       int offset = 0;
00049       offset += this->error_code.serialize(outbuffer + offset);
00050       offset += this->trajectory_start.serialize(outbuffer + offset);
00051       *(outbuffer + offset + 0) = (this->trajectory_stages_length >> (8 * 0)) & 0xFF;
00052       *(outbuffer + offset + 1) = (this->trajectory_stages_length >> (8 * 1)) & 0xFF;
00053       *(outbuffer + offset + 2) = (this->trajectory_stages_length >> (8 * 2)) & 0xFF;
00054       *(outbuffer + offset + 3) = (this->trajectory_stages_length >> (8 * 3)) & 0xFF;
00055       offset += sizeof(this->trajectory_stages_length);
00056       for( uint32_t i = 0; i < trajectory_stages_length; i++){
00057       offset += this->trajectory_stages[i].serialize(outbuffer + offset);
00058       }
00059       *(outbuffer + offset + 0) = (this->trajectory_descriptions_length >> (8 * 0)) & 0xFF;
00060       *(outbuffer + offset + 1) = (this->trajectory_descriptions_length >> (8 * 1)) & 0xFF;
00061       *(outbuffer + offset + 2) = (this->trajectory_descriptions_length >> (8 * 2)) & 0xFF;
00062       *(outbuffer + offset + 3) = (this->trajectory_descriptions_length >> (8 * 3)) & 0xFF;
00063       offset += sizeof(this->trajectory_descriptions_length);
00064       for( uint32_t i = 0; i < trajectory_descriptions_length; i++){
00065       uint32_t length_trajectory_descriptionsi = strlen(this->trajectory_descriptions[i]);
00066       varToArr(outbuffer + offset, length_trajectory_descriptionsi);
00067       offset += 4;
00068       memcpy(outbuffer + offset, this->trajectory_descriptions[i], length_trajectory_descriptionsi);
00069       offset += length_trajectory_descriptionsi;
00070       }
00071       offset += this->grasp.serialize(outbuffer + offset);
00072       union {
00073         double real;
00074         uint64_t base;
00075       } u_planning_time;
00076       u_planning_time.real = this->planning_time;
00077       *(outbuffer + offset + 0) = (u_planning_time.base >> (8 * 0)) & 0xFF;
00078       *(outbuffer + offset + 1) = (u_planning_time.base >> (8 * 1)) & 0xFF;
00079       *(outbuffer + offset + 2) = (u_planning_time.base >> (8 * 2)) & 0xFF;
00080       *(outbuffer + offset + 3) = (u_planning_time.base >> (8 * 3)) & 0xFF;
00081       *(outbuffer + offset + 4) = (u_planning_time.base >> (8 * 4)) & 0xFF;
00082       *(outbuffer + offset + 5) = (u_planning_time.base >> (8 * 5)) & 0xFF;
00083       *(outbuffer + offset + 6) = (u_planning_time.base >> (8 * 6)) & 0xFF;
00084       *(outbuffer + offset + 7) = (u_planning_time.base >> (8 * 7)) & 0xFF;
00085       offset += sizeof(this->planning_time);
00086       return offset;
00087     }
00088 
00089     virtual int deserialize(unsigned char *inbuffer)
00090     {
00091       int offset = 0;
00092       offset += this->error_code.deserialize(inbuffer + offset);
00093       offset += this->trajectory_start.deserialize(inbuffer + offset);
00094       uint32_t trajectory_stages_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00095       trajectory_stages_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00096       trajectory_stages_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00097       trajectory_stages_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00098       offset += sizeof(this->trajectory_stages_length);
00099       if(trajectory_stages_lengthT > trajectory_stages_length)
00100         this->trajectory_stages = (moveit_msgs::RobotTrajectory*)realloc(this->trajectory_stages, trajectory_stages_lengthT * sizeof(moveit_msgs::RobotTrajectory));
00101       trajectory_stages_length = trajectory_stages_lengthT;
00102       for( uint32_t i = 0; i < trajectory_stages_length; i++){
00103       offset += this->st_trajectory_stages.deserialize(inbuffer + offset);
00104         memcpy( &(this->trajectory_stages[i]), &(this->st_trajectory_stages), sizeof(moveit_msgs::RobotTrajectory));
00105       }
00106       uint32_t trajectory_descriptions_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00107       trajectory_descriptions_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00108       trajectory_descriptions_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00109       trajectory_descriptions_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00110       offset += sizeof(this->trajectory_descriptions_length);
00111       if(trajectory_descriptions_lengthT > trajectory_descriptions_length)
00112         this->trajectory_descriptions = (char**)realloc(this->trajectory_descriptions, trajectory_descriptions_lengthT * sizeof(char*));
00113       trajectory_descriptions_length = trajectory_descriptions_lengthT;
00114       for( uint32_t i = 0; i < trajectory_descriptions_length; i++){
00115       uint32_t length_st_trajectory_descriptions;
00116       arrToVar(length_st_trajectory_descriptions, (inbuffer + offset));
00117       offset += 4;
00118       for(unsigned int k= offset; k< offset+length_st_trajectory_descriptions; ++k){
00119           inbuffer[k-1]=inbuffer[k];
00120       }
00121       inbuffer[offset+length_st_trajectory_descriptions-1]=0;
00122       this->st_trajectory_descriptions = (char *)(inbuffer + offset-1);
00123       offset += length_st_trajectory_descriptions;
00124         memcpy( &(this->trajectory_descriptions[i]), &(this->st_trajectory_descriptions), sizeof(char*));
00125       }
00126       offset += this->grasp.deserialize(inbuffer + offset);
00127       union {
00128         double real;
00129         uint64_t base;
00130       } u_planning_time;
00131       u_planning_time.base = 0;
00132       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00133       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00134       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00135       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00136       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00137       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00138       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00139       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00140       this->planning_time = u_planning_time.real;
00141       offset += sizeof(this->planning_time);
00142      return offset;
00143     }
00144 
00145     virtual const char * getType(){ return "moveit_msgs/PickupResult"; };
00146     virtual const char * getMD5(){ return "c1e72234397d9de0761966243e264774"; };
00147 
00148   };
00149 
00150 }
00151 #endif