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

TeleportAbsolute.h

00001 #ifndef _ROS_SERVICE_TeleportAbsolute_h
00002 #define _ROS_SERVICE_TeleportAbsolute_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 
00008 namespace turtlesim
00009 {
00010 
00011 static const char TELEPORTABSOLUTE[] = "turtlesim/TeleportAbsolute";
00012 
00013   class TeleportAbsoluteRequest : public ros::Msg
00014   {
00015     public:
00016       float x;
00017       float y;
00018       float theta;
00019 
00020     TeleportAbsoluteRequest():
00021       x(0),
00022       y(0),
00023       theta(0)
00024     {
00025     }
00026 
00027     virtual int serialize(unsigned char *outbuffer) const
00028     {
00029       int offset = 0;
00030       union {
00031         float real;
00032         uint32_t base;
00033       } u_x;
00034       u_x.real = this->x;
00035       *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
00036       *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
00037       *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
00038       *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
00039       offset += sizeof(this->x);
00040       union {
00041         float real;
00042         uint32_t base;
00043       } u_y;
00044       u_y.real = this->y;
00045       *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
00046       *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
00047       *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
00048       *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
00049       offset += sizeof(this->y);
00050       union {
00051         float real;
00052         uint32_t base;
00053       } u_theta;
00054       u_theta.real = this->theta;
00055       *(outbuffer + offset + 0) = (u_theta.base >> (8 * 0)) & 0xFF;
00056       *(outbuffer + offset + 1) = (u_theta.base >> (8 * 1)) & 0xFF;
00057       *(outbuffer + offset + 2) = (u_theta.base >> (8 * 2)) & 0xFF;
00058       *(outbuffer + offset + 3) = (u_theta.base >> (8 * 3)) & 0xFF;
00059       offset += sizeof(this->theta);
00060       return offset;
00061     }
00062 
00063     virtual int deserialize(unsigned char *inbuffer)
00064     {
00065       int offset = 0;
00066       union {
00067         float real;
00068         uint32_t base;
00069       } u_x;
00070       u_x.base = 0;
00071       u_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00072       u_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00073       u_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00074       u_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00075       this->x = u_x.real;
00076       offset += sizeof(this->x);
00077       union {
00078         float real;
00079         uint32_t base;
00080       } u_y;
00081       u_y.base = 0;
00082       u_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00083       u_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00084       u_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00085       u_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00086       this->y = u_y.real;
00087       offset += sizeof(this->y);
00088       union {
00089         float real;
00090         uint32_t base;
00091       } u_theta;
00092       u_theta.base = 0;
00093       u_theta.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00094       u_theta.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00095       u_theta.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00096       u_theta.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00097       this->theta = u_theta.real;
00098       offset += sizeof(this->theta);
00099      return offset;
00100     }
00101 
00102     const char * getType(){ return TELEPORTABSOLUTE; };
00103     const char * getMD5(){ return "a130bc60ee6513855dc62ea83fcc5b20"; };
00104 
00105   };
00106 
00107   class TeleportAbsoluteResponse : public ros::Msg
00108   {
00109     public:
00110 
00111     TeleportAbsoluteResponse()
00112     {
00113     }
00114 
00115     virtual int serialize(unsigned char *outbuffer) const
00116     {
00117       int offset = 0;
00118       return offset;
00119     }
00120 
00121     virtual int deserialize(unsigned char *inbuffer)
00122     {
00123       int offset = 0;
00124      return offset;
00125     }
00126 
00127     const char * getType(){ return TELEPORTABSOLUTE; };
00128     const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00129 
00130   };
00131 
00132   class TeleportAbsolute {
00133     public:
00134     typedef TeleportAbsoluteRequest Request;
00135     typedef TeleportAbsoluteResponse Response;
00136   };
00137 
00138 }
00139 #endif