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 FollowJointTrajectoryGoal.h Source File

FollowJointTrajectoryGoal.h

00001 #ifndef _ROS_control_msgs_FollowJointTrajectoryGoal_h
00002 #define _ROS_control_msgs_FollowJointTrajectoryGoal_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "trajectory_msgs/JointTrajectory.h"
00009 #include "control_msgs/JointTolerance.h"
00010 #include "ros/duration.h"
00011 
00012 namespace control_msgs
00013 {
00014 
00015   class FollowJointTrajectoryGoal : public ros::Msg
00016   {
00017     public:
00018       trajectory_msgs::JointTrajectory trajectory;
00019       uint8_t path_tolerance_length;
00020       control_msgs::JointTolerance st_path_tolerance;
00021       control_msgs::JointTolerance * path_tolerance;
00022       uint8_t goal_tolerance_length;
00023       control_msgs::JointTolerance st_goal_tolerance;
00024       control_msgs::JointTolerance * goal_tolerance;
00025       ros::Duration goal_time_tolerance;
00026 
00027     FollowJointTrajectoryGoal():
00028       trajectory(),
00029       path_tolerance_length(0), path_tolerance(NULL),
00030       goal_tolerance_length(0), goal_tolerance(NULL),
00031       goal_time_tolerance()
00032     {
00033     }
00034 
00035     virtual int serialize(unsigned char *outbuffer) const
00036     {
00037       int offset = 0;
00038       offset += this->trajectory.serialize(outbuffer + offset);
00039       *(outbuffer + offset++) = path_tolerance_length;
00040       *(outbuffer + offset++) = 0;
00041       *(outbuffer + offset++) = 0;
00042       *(outbuffer + offset++) = 0;
00043       for( uint8_t i = 0; i < path_tolerance_length; i++){
00044       offset += this->path_tolerance[i].serialize(outbuffer + offset);
00045       }
00046       *(outbuffer + offset++) = goal_tolerance_length;
00047       *(outbuffer + offset++) = 0;
00048       *(outbuffer + offset++) = 0;
00049       *(outbuffer + offset++) = 0;
00050       for( uint8_t i = 0; i < goal_tolerance_length; i++){
00051       offset += this->goal_tolerance[i].serialize(outbuffer + offset);
00052       }
00053       *(outbuffer + offset + 0) = (this->goal_time_tolerance.sec >> (8 * 0)) & 0xFF;
00054       *(outbuffer + offset + 1) = (this->goal_time_tolerance.sec >> (8 * 1)) & 0xFF;
00055       *(outbuffer + offset + 2) = (this->goal_time_tolerance.sec >> (8 * 2)) & 0xFF;
00056       *(outbuffer + offset + 3) = (this->goal_time_tolerance.sec >> (8 * 3)) & 0xFF;
00057       offset += sizeof(this->goal_time_tolerance.sec);
00058       *(outbuffer + offset + 0) = (this->goal_time_tolerance.nsec >> (8 * 0)) & 0xFF;
00059       *(outbuffer + offset + 1) = (this->goal_time_tolerance.nsec >> (8 * 1)) & 0xFF;
00060       *(outbuffer + offset + 2) = (this->goal_time_tolerance.nsec >> (8 * 2)) & 0xFF;
00061       *(outbuffer + offset + 3) = (this->goal_time_tolerance.nsec >> (8 * 3)) & 0xFF;
00062       offset += sizeof(this->goal_time_tolerance.nsec);
00063       return offset;
00064     }
00065 
00066     virtual int deserialize(unsigned char *inbuffer)
00067     {
00068       int offset = 0;
00069       offset += this->trajectory.deserialize(inbuffer + offset);
00070       uint8_t path_tolerance_lengthT = *(inbuffer + offset++);
00071       if(path_tolerance_lengthT > path_tolerance_length)
00072         this->path_tolerance = (control_msgs::JointTolerance*)realloc(this->path_tolerance, path_tolerance_lengthT * sizeof(control_msgs::JointTolerance));
00073       offset += 3;
00074       path_tolerance_length = path_tolerance_lengthT;
00075       for( uint8_t i = 0; i < path_tolerance_length; i++){
00076       offset += this->st_path_tolerance.deserialize(inbuffer + offset);
00077         memcpy( &(this->path_tolerance[i]), &(this->st_path_tolerance), sizeof(control_msgs::JointTolerance));
00078       }
00079       uint8_t goal_tolerance_lengthT = *(inbuffer + offset++);
00080       if(goal_tolerance_lengthT > goal_tolerance_length)
00081         this->goal_tolerance = (control_msgs::JointTolerance*)realloc(this->goal_tolerance, goal_tolerance_lengthT * sizeof(control_msgs::JointTolerance));
00082       offset += 3;
00083       goal_tolerance_length = goal_tolerance_lengthT;
00084       for( uint8_t i = 0; i < goal_tolerance_length; i++){
00085       offset += this->st_goal_tolerance.deserialize(inbuffer + offset);
00086         memcpy( &(this->goal_tolerance[i]), &(this->st_goal_tolerance), sizeof(control_msgs::JointTolerance));
00087       }
00088       this->goal_time_tolerance.sec =  ((uint32_t) (*(inbuffer + offset)));
00089       this->goal_time_tolerance.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00090       this->goal_time_tolerance.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00091       this->goal_time_tolerance.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00092       offset += sizeof(this->goal_time_tolerance.sec);
00093       this->goal_time_tolerance.nsec =  ((uint32_t) (*(inbuffer + offset)));
00094       this->goal_time_tolerance.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00095       this->goal_time_tolerance.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00096       this->goal_time_tolerance.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00097       offset += sizeof(this->goal_time_tolerance.nsec);
00098      return offset;
00099     }
00100 
00101     const char * getType(){ return "control_msgs/FollowJointTrajectoryGoal"; };
00102     const char * getMD5(){ return "69636787b6ecbde4d61d711979bc7ecb"; };
00103 
00104   };
00105 
00106 }
00107 #endif