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

SingleJointPositionFeedback.h

00001 #ifndef _ROS_control_msgs_SingleJointPositionFeedback_h
00002 #define _ROS_control_msgs_SingleJointPositionFeedback_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 
00010 namespace control_msgs
00011 {
00012 
00013   class SingleJointPositionFeedback : public ros::Msg
00014   {
00015     public:
00016       std_msgs::Header header;
00017       double position;
00018       double velocity;
00019       double error;
00020 
00021     SingleJointPositionFeedback():
00022       header(),
00023       position(0),
00024       velocity(0),
00025       error(0)
00026     {
00027     }
00028 
00029     virtual int serialize(unsigned char *outbuffer) const
00030     {
00031       int offset = 0;
00032       offset += this->header.serialize(outbuffer + offset);
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       union {
00048         double real;
00049         uint64_t base;
00050       } u_velocity;
00051       u_velocity.real = this->velocity;
00052       *(outbuffer + offset + 0) = (u_velocity.base >> (8 * 0)) & 0xFF;
00053       *(outbuffer + offset + 1) = (u_velocity.base >> (8 * 1)) & 0xFF;
00054       *(outbuffer + offset + 2) = (u_velocity.base >> (8 * 2)) & 0xFF;
00055       *(outbuffer + offset + 3) = (u_velocity.base >> (8 * 3)) & 0xFF;
00056       *(outbuffer + offset + 4) = (u_velocity.base >> (8 * 4)) & 0xFF;
00057       *(outbuffer + offset + 5) = (u_velocity.base >> (8 * 5)) & 0xFF;
00058       *(outbuffer + offset + 6) = (u_velocity.base >> (8 * 6)) & 0xFF;
00059       *(outbuffer + offset + 7) = (u_velocity.base >> (8 * 7)) & 0xFF;
00060       offset += sizeof(this->velocity);
00061       union {
00062         double real;
00063         uint64_t base;
00064       } u_error;
00065       u_error.real = this->error;
00066       *(outbuffer + offset + 0) = (u_error.base >> (8 * 0)) & 0xFF;
00067       *(outbuffer + offset + 1) = (u_error.base >> (8 * 1)) & 0xFF;
00068       *(outbuffer + offset + 2) = (u_error.base >> (8 * 2)) & 0xFF;
00069       *(outbuffer + offset + 3) = (u_error.base >> (8 * 3)) & 0xFF;
00070       *(outbuffer + offset + 4) = (u_error.base >> (8 * 4)) & 0xFF;
00071       *(outbuffer + offset + 5) = (u_error.base >> (8 * 5)) & 0xFF;
00072       *(outbuffer + offset + 6) = (u_error.base >> (8 * 6)) & 0xFF;
00073       *(outbuffer + offset + 7) = (u_error.base >> (8 * 7)) & 0xFF;
00074       offset += sizeof(this->error);
00075       return offset;
00076     }
00077 
00078     virtual int deserialize(unsigned char *inbuffer)
00079     {
00080       int offset = 0;
00081       offset += this->header.deserialize(inbuffer + offset);
00082       union {
00083         double real;
00084         uint64_t base;
00085       } u_position;
00086       u_position.base = 0;
00087       u_position.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00088       u_position.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00089       u_position.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00090       u_position.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00091       u_position.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00092       u_position.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00093       u_position.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00094       u_position.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00095       this->position = u_position.real;
00096       offset += sizeof(this->position);
00097       union {
00098         double real;
00099         uint64_t base;
00100       } u_velocity;
00101       u_velocity.base = 0;
00102       u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00103       u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00104       u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00105       u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00106       u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00107       u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00108       u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00109       u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00110       this->velocity = u_velocity.real;
00111       offset += sizeof(this->velocity);
00112       union {
00113         double real;
00114         uint64_t base;
00115       } u_error;
00116       u_error.base = 0;
00117       u_error.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00118       u_error.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00119       u_error.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00120       u_error.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00121       u_error.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00122       u_error.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00123       u_error.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00124       u_error.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00125       this->error = u_error.real;
00126       offset += sizeof(this->error);
00127      return offset;
00128     }
00129 
00130     const char * getType(){ return "control_msgs/SingleJointPositionFeedback"; };
00131     const char * getMD5(){ return "8cee65610a3d08e0a1bded82f146f1fd"; };
00132 
00133   };
00134 
00135 }
00136 #endif