Gary Servin / ros_lib_indigo

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