Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FollowJointTrajectoryFeedback.h Source File

FollowJointTrajectoryFeedback.h

00001 #ifndef _ROS_control_msgs_FollowJointTrajectoryFeedback_h
00002 #define _ROS_control_msgs_FollowJointTrajectoryFeedback_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "trajectory_msgs/JointTrajectoryPoint.h"
00010 
00011 namespace control_msgs
00012 {
00013 
00014   class FollowJointTrajectoryFeedback : public ros::Msg
00015   {
00016     public:
00017       typedef std_msgs::Header _header_type;
00018       _header_type header;
00019       uint32_t joint_names_length;
00020       typedef char* _joint_names_type;
00021       _joint_names_type st_joint_names;
00022       _joint_names_type * joint_names;
00023       typedef trajectory_msgs::JointTrajectoryPoint _desired_type;
00024       _desired_type desired;
00025       typedef trajectory_msgs::JointTrajectoryPoint _actual_type;
00026       _actual_type actual;
00027       typedef trajectory_msgs::JointTrajectoryPoint _error_type;
00028       _error_type error;
00029 
00030     FollowJointTrajectoryFeedback():
00031       header(),
00032       joint_names_length(0), joint_names(NULL),
00033       desired(),
00034       actual(),
00035       error()
00036     {
00037     }
00038 
00039     virtual int serialize(unsigned char *outbuffer) const
00040     {
00041       int offset = 0;
00042       offset += this->header.serialize(outbuffer + offset);
00043       *(outbuffer + offset + 0) = (this->joint_names_length >> (8 * 0)) & 0xFF;
00044       *(outbuffer + offset + 1) = (this->joint_names_length >> (8 * 1)) & 0xFF;
00045       *(outbuffer + offset + 2) = (this->joint_names_length >> (8 * 2)) & 0xFF;
00046       *(outbuffer + offset + 3) = (this->joint_names_length >> (8 * 3)) & 0xFF;
00047       offset += sizeof(this->joint_names_length);
00048       for( uint32_t i = 0; i < joint_names_length; i++){
00049       uint32_t length_joint_namesi = strlen(this->joint_names[i]);
00050       varToArr(outbuffer + offset, length_joint_namesi);
00051       offset += 4;
00052       memcpy(outbuffer + offset, this->joint_names[i], length_joint_namesi);
00053       offset += length_joint_namesi;
00054       }
00055       offset += this->desired.serialize(outbuffer + offset);
00056       offset += this->actual.serialize(outbuffer + offset);
00057       offset += this->error.serialize(outbuffer + offset);
00058       return offset;
00059     }
00060 
00061     virtual int deserialize(unsigned char *inbuffer)
00062     {
00063       int offset = 0;
00064       offset += this->header.deserialize(inbuffer + offset);
00065       uint32_t joint_names_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00066       joint_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00067       joint_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00068       joint_names_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00069       offset += sizeof(this->joint_names_length);
00070       if(joint_names_lengthT > joint_names_length)
00071         this->joint_names = (char**)realloc(this->joint_names, joint_names_lengthT * sizeof(char*));
00072       joint_names_length = joint_names_lengthT;
00073       for( uint32_t i = 0; i < joint_names_length; i++){
00074       uint32_t length_st_joint_names;
00075       arrToVar(length_st_joint_names, (inbuffer + offset));
00076       offset += 4;
00077       for(unsigned int k= offset; k< offset+length_st_joint_names; ++k){
00078           inbuffer[k-1]=inbuffer[k];
00079       }
00080       inbuffer[offset+length_st_joint_names-1]=0;
00081       this->st_joint_names = (char *)(inbuffer + offset-1);
00082       offset += length_st_joint_names;
00083         memcpy( &(this->joint_names[i]), &(this->st_joint_names), sizeof(char*));
00084       }
00085       offset += this->desired.deserialize(inbuffer + offset);
00086       offset += this->actual.deserialize(inbuffer + offset);
00087       offset += this->error.deserialize(inbuffer + offset);
00088      return offset;
00089     }
00090 
00091     const char * getType(){ return "control_msgs/FollowJointTrajectoryFeedback"; };
00092     const char * getMD5(){ return "10817c60c2486ef6b33e97dcd87f4474"; };
00093 
00094   };
00095 
00096 }
00097 #endif