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

SingleJointPositionGoal.h

00001 #ifndef _ROS_control_msgs_SingleJointPositionGoal_h
00002 #define _ROS_control_msgs_SingleJointPositionGoal_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "ros/duration.h"
00009 
00010 namespace control_msgs
00011 {
00012 
00013   class SingleJointPositionGoal : public ros::Msg
00014   {
00015     public:
00016       typedef double _position_type;
00017       _position_type position;
00018       typedef ros::Duration _min_duration_type;
00019       _min_duration_type min_duration;
00020       typedef double _max_velocity_type;
00021       _max_velocity_type max_velocity;
00022 
00023     SingleJointPositionGoal():
00024       position(0),
00025       min_duration(),
00026       max_velocity(0)
00027     {
00028     }
00029 
00030     virtual int serialize(unsigned char *outbuffer) const
00031     {
00032       int offset = 0;
00033       union {
00034         double real;
00035         uint64_t base;
00036       } u_position;
00037       u_position.real = this->position;
00038       *(outbuffer + offset + 0) = (u_position.base >> (8 * 0)) & 0xFF;
00039       *(outbuffer + offset + 1) = (u_position.base >> (8 * 1)) & 0xFF;
00040       *(outbuffer + offset + 2) = (u_position.base >> (8 * 2)) & 0xFF;
00041       *(outbuffer + offset + 3) = (u_position.base >> (8 * 3)) & 0xFF;
00042       *(outbuffer + offset + 4) = (u_position.base >> (8 * 4)) & 0xFF;
00043       *(outbuffer + offset + 5) = (u_position.base >> (8 * 5)) & 0xFF;
00044       *(outbuffer + offset + 6) = (u_position.base >> (8 * 6)) & 0xFF;
00045       *(outbuffer + offset + 7) = (u_position.base >> (8 * 7)) & 0xFF;
00046       offset += sizeof(this->position);
00047       *(outbuffer + offset + 0) = (this->min_duration.sec >> (8 * 0)) & 0xFF;
00048       *(outbuffer + offset + 1) = (this->min_duration.sec >> (8 * 1)) & 0xFF;
00049       *(outbuffer + offset + 2) = (this->min_duration.sec >> (8 * 2)) & 0xFF;
00050       *(outbuffer + offset + 3) = (this->min_duration.sec >> (8 * 3)) & 0xFF;
00051       offset += sizeof(this->min_duration.sec);
00052       *(outbuffer + offset + 0) = (this->min_duration.nsec >> (8 * 0)) & 0xFF;
00053       *(outbuffer + offset + 1) = (this->min_duration.nsec >> (8 * 1)) & 0xFF;
00054       *(outbuffer + offset + 2) = (this->min_duration.nsec >> (8 * 2)) & 0xFF;
00055       *(outbuffer + offset + 3) = (this->min_duration.nsec >> (8 * 3)) & 0xFF;
00056       offset += sizeof(this->min_duration.nsec);
00057       union {
00058         double real;
00059         uint64_t base;
00060       } u_max_velocity;
00061       u_max_velocity.real = this->max_velocity;
00062       *(outbuffer + offset + 0) = (u_max_velocity.base >> (8 * 0)) & 0xFF;
00063       *(outbuffer + offset + 1) = (u_max_velocity.base >> (8 * 1)) & 0xFF;
00064       *(outbuffer + offset + 2) = (u_max_velocity.base >> (8 * 2)) & 0xFF;
00065       *(outbuffer + offset + 3) = (u_max_velocity.base >> (8 * 3)) & 0xFF;
00066       *(outbuffer + offset + 4) = (u_max_velocity.base >> (8 * 4)) & 0xFF;
00067       *(outbuffer + offset + 5) = (u_max_velocity.base >> (8 * 5)) & 0xFF;
00068       *(outbuffer + offset + 6) = (u_max_velocity.base >> (8 * 6)) & 0xFF;
00069       *(outbuffer + offset + 7) = (u_max_velocity.base >> (8 * 7)) & 0xFF;
00070       offset += sizeof(this->max_velocity);
00071       return offset;
00072     }
00073 
00074     virtual int deserialize(unsigned char *inbuffer)
00075     {
00076       int offset = 0;
00077       union {
00078         double real;
00079         uint64_t base;
00080       } u_position;
00081       u_position.base = 0;
00082       u_position.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00083       u_position.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00084       u_position.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00085       u_position.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00086       u_position.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00087       u_position.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00088       u_position.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00089       u_position.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00090       this->position = u_position.real;
00091       offset += sizeof(this->position);
00092       this->min_duration.sec =  ((uint32_t) (*(inbuffer + offset)));
00093       this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00094       this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00095       this->min_duration.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00096       offset += sizeof(this->min_duration.sec);
00097       this->min_duration.nsec =  ((uint32_t) (*(inbuffer + offset)));
00098       this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00099       this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00100       this->min_duration.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00101       offset += sizeof(this->min_duration.nsec);
00102       union {
00103         double real;
00104         uint64_t base;
00105       } u_max_velocity;
00106       u_max_velocity.base = 0;
00107       u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00108       u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00109       u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00110       u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00111       u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00112       u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00113       u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00114       u_max_velocity.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00115       this->max_velocity = u_max_velocity.real;
00116       offset += sizeof(this->max_velocity);
00117      return offset;
00118     }
00119 
00120     const char * getType(){ return "control_msgs/SingleJointPositionGoal"; };
00121     const char * getMD5(){ return "fbaaa562a23a013fd5053e5f72cbb35c"; };
00122 
00123   };
00124 
00125 }
00126 #endif