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