catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MotionPlanDetailedResponse.h Source File

MotionPlanDetailedResponse.h

00001 #ifndef _ROS_moveit_msgs_MotionPlanDetailedResponse_h
00002 #define _ROS_moveit_msgs_MotionPlanDetailedResponse_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "moveit_msgs/RobotState.h"
00009 #include "moveit_msgs/RobotTrajectory.h"
00010 #include "moveit_msgs/MoveItErrorCodes.h"
00011 
00012 namespace moveit_msgs
00013 {
00014 
00015   class MotionPlanDetailedResponse : public ros::Msg
00016   {
00017     public:
00018       typedef moveit_msgs::RobotState _trajectory_start_type;
00019       _trajectory_start_type trajectory_start;
00020       typedef const char* _group_name_type;
00021       _group_name_type group_name;
00022       uint32_t trajectory_length;
00023       typedef moveit_msgs::RobotTrajectory _trajectory_type;
00024       _trajectory_type st_trajectory;
00025       _trajectory_type * trajectory;
00026       uint32_t description_length;
00027       typedef char* _description_type;
00028       _description_type st_description;
00029       _description_type * description;
00030       uint32_t processing_time_length;
00031       typedef double _processing_time_type;
00032       _processing_time_type st_processing_time;
00033       _processing_time_type * processing_time;
00034       typedef moveit_msgs::MoveItErrorCodes _error_code_type;
00035       _error_code_type error_code;
00036 
00037     MotionPlanDetailedResponse():
00038       trajectory_start(),
00039       group_name(""),
00040       trajectory_length(0), trajectory(NULL),
00041       description_length(0), description(NULL),
00042       processing_time_length(0), processing_time(NULL),
00043       error_code()
00044     {
00045     }
00046 
00047     virtual int serialize(unsigned char *outbuffer) const
00048     {
00049       int offset = 0;
00050       offset += this->trajectory_start.serialize(outbuffer + offset);
00051       uint32_t length_group_name = strlen(this->group_name);
00052       varToArr(outbuffer + offset, length_group_name);
00053       offset += 4;
00054       memcpy(outbuffer + offset, this->group_name, length_group_name);
00055       offset += length_group_name;
00056       *(outbuffer + offset + 0) = (this->trajectory_length >> (8 * 0)) & 0xFF;
00057       *(outbuffer + offset + 1) = (this->trajectory_length >> (8 * 1)) & 0xFF;
00058       *(outbuffer + offset + 2) = (this->trajectory_length >> (8 * 2)) & 0xFF;
00059       *(outbuffer + offset + 3) = (this->trajectory_length >> (8 * 3)) & 0xFF;
00060       offset += sizeof(this->trajectory_length);
00061       for( uint32_t i = 0; i < trajectory_length; i++){
00062       offset += this->trajectory[i].serialize(outbuffer + offset);
00063       }
00064       *(outbuffer + offset + 0) = (this->description_length >> (8 * 0)) & 0xFF;
00065       *(outbuffer + offset + 1) = (this->description_length >> (8 * 1)) & 0xFF;
00066       *(outbuffer + offset + 2) = (this->description_length >> (8 * 2)) & 0xFF;
00067       *(outbuffer + offset + 3) = (this->description_length >> (8 * 3)) & 0xFF;
00068       offset += sizeof(this->description_length);
00069       for( uint32_t i = 0; i < description_length; i++){
00070       uint32_t length_descriptioni = strlen(this->description[i]);
00071       varToArr(outbuffer + offset, length_descriptioni);
00072       offset += 4;
00073       memcpy(outbuffer + offset, this->description[i], length_descriptioni);
00074       offset += length_descriptioni;
00075       }
00076       *(outbuffer + offset + 0) = (this->processing_time_length >> (8 * 0)) & 0xFF;
00077       *(outbuffer + offset + 1) = (this->processing_time_length >> (8 * 1)) & 0xFF;
00078       *(outbuffer + offset + 2) = (this->processing_time_length >> (8 * 2)) & 0xFF;
00079       *(outbuffer + offset + 3) = (this->processing_time_length >> (8 * 3)) & 0xFF;
00080       offset += sizeof(this->processing_time_length);
00081       for( uint32_t i = 0; i < processing_time_length; i++){
00082       union {
00083         double real;
00084         uint64_t base;
00085       } u_processing_timei;
00086       u_processing_timei.real = this->processing_time[i];
00087       *(outbuffer + offset + 0) = (u_processing_timei.base >> (8 * 0)) & 0xFF;
00088       *(outbuffer + offset + 1) = (u_processing_timei.base >> (8 * 1)) & 0xFF;
00089       *(outbuffer + offset + 2) = (u_processing_timei.base >> (8 * 2)) & 0xFF;
00090       *(outbuffer + offset + 3) = (u_processing_timei.base >> (8 * 3)) & 0xFF;
00091       *(outbuffer + offset + 4) = (u_processing_timei.base >> (8 * 4)) & 0xFF;
00092       *(outbuffer + offset + 5) = (u_processing_timei.base >> (8 * 5)) & 0xFF;
00093       *(outbuffer + offset + 6) = (u_processing_timei.base >> (8 * 6)) & 0xFF;
00094       *(outbuffer + offset + 7) = (u_processing_timei.base >> (8 * 7)) & 0xFF;
00095       offset += sizeof(this->processing_time[i]);
00096       }
00097       offset += this->error_code.serialize(outbuffer + offset);
00098       return offset;
00099     }
00100 
00101     virtual int deserialize(unsigned char *inbuffer)
00102     {
00103       int offset = 0;
00104       offset += this->trajectory_start.deserialize(inbuffer + offset);
00105       uint32_t length_group_name;
00106       arrToVar(length_group_name, (inbuffer + offset));
00107       offset += 4;
00108       for(unsigned int k= offset; k< offset+length_group_name; ++k){
00109           inbuffer[k-1]=inbuffer[k];
00110       }
00111       inbuffer[offset+length_group_name-1]=0;
00112       this->group_name = (char *)(inbuffer + offset-1);
00113       offset += length_group_name;
00114       uint32_t trajectory_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00115       trajectory_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00116       trajectory_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00117       trajectory_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00118       offset += sizeof(this->trajectory_length);
00119       if(trajectory_lengthT > trajectory_length)
00120         this->trajectory = (moveit_msgs::RobotTrajectory*)realloc(this->trajectory, trajectory_lengthT * sizeof(moveit_msgs::RobotTrajectory));
00121       trajectory_length = trajectory_lengthT;
00122       for( uint32_t i = 0; i < trajectory_length; i++){
00123       offset += this->st_trajectory.deserialize(inbuffer + offset);
00124         memcpy( &(this->trajectory[i]), &(this->st_trajectory), sizeof(moveit_msgs::RobotTrajectory));
00125       }
00126       uint32_t description_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00127       description_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00128       description_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00129       description_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00130       offset += sizeof(this->description_length);
00131       if(description_lengthT > description_length)
00132         this->description = (char**)realloc(this->description, description_lengthT * sizeof(char*));
00133       description_length = description_lengthT;
00134       for( uint32_t i = 0; i < description_length; i++){
00135       uint32_t length_st_description;
00136       arrToVar(length_st_description, (inbuffer + offset));
00137       offset += 4;
00138       for(unsigned int k= offset; k< offset+length_st_description; ++k){
00139           inbuffer[k-1]=inbuffer[k];
00140       }
00141       inbuffer[offset+length_st_description-1]=0;
00142       this->st_description = (char *)(inbuffer + offset-1);
00143       offset += length_st_description;
00144         memcpy( &(this->description[i]), &(this->st_description), sizeof(char*));
00145       }
00146       uint32_t processing_time_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00147       processing_time_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00148       processing_time_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00149       processing_time_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00150       offset += sizeof(this->processing_time_length);
00151       if(processing_time_lengthT > processing_time_length)
00152         this->processing_time = (double*)realloc(this->processing_time, processing_time_lengthT * sizeof(double));
00153       processing_time_length = processing_time_lengthT;
00154       for( uint32_t i = 0; i < processing_time_length; i++){
00155       union {
00156         double real;
00157         uint64_t base;
00158       } u_st_processing_time;
00159       u_st_processing_time.base = 0;
00160       u_st_processing_time.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00161       u_st_processing_time.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00162       u_st_processing_time.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00163       u_st_processing_time.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00164       u_st_processing_time.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00165       u_st_processing_time.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00166       u_st_processing_time.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00167       u_st_processing_time.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00168       this->st_processing_time = u_st_processing_time.real;
00169       offset += sizeof(this->st_processing_time);
00170         memcpy( &(this->processing_time[i]), &(this->st_processing_time), sizeof(double));
00171       }
00172       offset += this->error_code.deserialize(inbuffer + offset);
00173      return offset;
00174     }
00175 
00176     virtual const char * getType(){ return "moveit_msgs/MotionPlanDetailedResponse"; };
00177     virtual const char * getMD5(){ return "7b84c374bb2e37bdc0eba664f7636a8f"; };
00178 
00179   };
00180 
00181 }
00182 #endif