catchrobo2022 mbed LPC1768 メインプログラム

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MotionSequenceResponse.h Source File

MotionSequenceResponse.h

00001 #ifndef _ROS_moveit_msgs_MotionSequenceResponse_h
00002 #define _ROS_moveit_msgs_MotionSequenceResponse_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 
00012 namespace moveit_msgs
00013 {
00014 
00015   class MotionSequenceResponse : public ros::Msg
00016   {
00017     public:
00018       typedef moveit_msgs::MoveItErrorCodes _error_code_type;
00019       _error_code_type error_code;
00020       typedef moveit_msgs::RobotState _sequence_start_type;
00021       _sequence_start_type sequence_start;
00022       uint32_t planned_trajectories_length;
00023       typedef moveit_msgs::RobotTrajectory _planned_trajectories_type;
00024       _planned_trajectories_type st_planned_trajectories;
00025       _planned_trajectories_type * planned_trajectories;
00026       typedef double _planning_time_type;
00027       _planning_time_type planning_time;
00028 
00029     MotionSequenceResponse():
00030       error_code(),
00031       sequence_start(),
00032       planned_trajectories_length(0), planned_trajectories(NULL),
00033       planning_time(0)
00034     {
00035     }
00036 
00037     virtual int serialize(unsigned char *outbuffer) const
00038     {
00039       int offset = 0;
00040       offset += this->error_code.serialize(outbuffer + offset);
00041       offset += this->sequence_start.serialize(outbuffer + offset);
00042       *(outbuffer + offset + 0) = (this->planned_trajectories_length >> (8 * 0)) & 0xFF;
00043       *(outbuffer + offset + 1) = (this->planned_trajectories_length >> (8 * 1)) & 0xFF;
00044       *(outbuffer + offset + 2) = (this->planned_trajectories_length >> (8 * 2)) & 0xFF;
00045       *(outbuffer + offset + 3) = (this->planned_trajectories_length >> (8 * 3)) & 0xFF;
00046       offset += sizeof(this->planned_trajectories_length);
00047       for( uint32_t i = 0; i < planned_trajectories_length; i++){
00048       offset += this->planned_trajectories[i].serialize(outbuffer + offset);
00049       }
00050       union {
00051         double real;
00052         uint64_t base;
00053       } u_planning_time;
00054       u_planning_time.real = this->planning_time;
00055       *(outbuffer + offset + 0) = (u_planning_time.base >> (8 * 0)) & 0xFF;
00056       *(outbuffer + offset + 1) = (u_planning_time.base >> (8 * 1)) & 0xFF;
00057       *(outbuffer + offset + 2) = (u_planning_time.base >> (8 * 2)) & 0xFF;
00058       *(outbuffer + offset + 3) = (u_planning_time.base >> (8 * 3)) & 0xFF;
00059       *(outbuffer + offset + 4) = (u_planning_time.base >> (8 * 4)) & 0xFF;
00060       *(outbuffer + offset + 5) = (u_planning_time.base >> (8 * 5)) & 0xFF;
00061       *(outbuffer + offset + 6) = (u_planning_time.base >> (8 * 6)) & 0xFF;
00062       *(outbuffer + offset + 7) = (u_planning_time.base >> (8 * 7)) & 0xFF;
00063       offset += sizeof(this->planning_time);
00064       return offset;
00065     }
00066 
00067     virtual int deserialize(unsigned char *inbuffer)
00068     {
00069       int offset = 0;
00070       offset += this->error_code.deserialize(inbuffer + offset);
00071       offset += this->sequence_start.deserialize(inbuffer + offset);
00072       uint32_t planned_trajectories_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00073       planned_trajectories_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00074       planned_trajectories_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00075       planned_trajectories_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00076       offset += sizeof(this->planned_trajectories_length);
00077       if(planned_trajectories_lengthT > planned_trajectories_length)
00078         this->planned_trajectories = (moveit_msgs::RobotTrajectory*)realloc(this->planned_trajectories, planned_trajectories_lengthT * sizeof(moveit_msgs::RobotTrajectory));
00079       planned_trajectories_length = planned_trajectories_lengthT;
00080       for( uint32_t i = 0; i < planned_trajectories_length; i++){
00081       offset += this->st_planned_trajectories.deserialize(inbuffer + offset);
00082         memcpy( &(this->planned_trajectories[i]), &(this->st_planned_trajectories), sizeof(moveit_msgs::RobotTrajectory));
00083       }
00084       union {
00085         double real;
00086         uint64_t base;
00087       } u_planning_time;
00088       u_planning_time.base = 0;
00089       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00090       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00091       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00092       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00093       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00094       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00095       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00096       u_planning_time.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00097       this->planning_time = u_planning_time.real;
00098       offset += sizeof(this->planning_time);
00099      return offset;
00100     }
00101 
00102     virtual const char * getType(){ return "moveit_msgs/MotionSequenceResponse"; };
00103     virtual const char * getMD5(){ return "3b9d4e8079db4576e4829d30617a3d1d"; };
00104 
00105   };
00106 
00107 }
00108 #endif