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

TeleportRelative.h

00001 #ifndef _ROS_SERVICE_TeleportRelative_h
00002 #define _ROS_SERVICE_TeleportRelative_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 TELEPORTRELATIVE[] = "turtlesim/TeleportRelative";
00012 
00013   class TeleportRelativeRequest : public ros::Msg
00014   {
00015     public:
00016       float linear;
00017       float angular;
00018 
00019     TeleportRelativeRequest():
00020       linear(0),
00021       angular(0)
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       union {
00029         float real;
00030         uint32_t base;
00031       } u_linear;
00032       u_linear.real = this->linear;
00033       *(outbuffer + offset + 0) = (u_linear.base >> (8 * 0)) & 0xFF;
00034       *(outbuffer + offset + 1) = (u_linear.base >> (8 * 1)) & 0xFF;
00035       *(outbuffer + offset + 2) = (u_linear.base >> (8 * 2)) & 0xFF;
00036       *(outbuffer + offset + 3) = (u_linear.base >> (8 * 3)) & 0xFF;
00037       offset += sizeof(this->linear);
00038       union {
00039         float real;
00040         uint32_t base;
00041       } u_angular;
00042       u_angular.real = this->angular;
00043       *(outbuffer + offset + 0) = (u_angular.base >> (8 * 0)) & 0xFF;
00044       *(outbuffer + offset + 1) = (u_angular.base >> (8 * 1)) & 0xFF;
00045       *(outbuffer + offset + 2) = (u_angular.base >> (8 * 2)) & 0xFF;
00046       *(outbuffer + offset + 3) = (u_angular.base >> (8 * 3)) & 0xFF;
00047       offset += sizeof(this->angular);
00048       return offset;
00049     }
00050 
00051     virtual int deserialize(unsigned char *inbuffer)
00052     {
00053       int offset = 0;
00054       union {
00055         float real;
00056         uint32_t base;
00057       } u_linear;
00058       u_linear.base = 0;
00059       u_linear.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00060       u_linear.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00061       u_linear.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00062       u_linear.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00063       this->linear = u_linear.real;
00064       offset += sizeof(this->linear);
00065       union {
00066         float real;
00067         uint32_t base;
00068       } u_angular;
00069       u_angular.base = 0;
00070       u_angular.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00071       u_angular.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00072       u_angular.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00073       u_angular.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00074       this->angular = u_angular.real;
00075       offset += sizeof(this->angular);
00076      return offset;
00077     }
00078 
00079     const char * getType(){ return TELEPORTRELATIVE; };
00080     const char * getMD5(){ return "9d5c2dcd348ac8f76ce2a4307bd63a13"; };
00081 
00082   };
00083 
00084   class TeleportRelativeResponse : public ros::Msg
00085   {
00086     public:
00087 
00088     TeleportRelativeResponse()
00089     {
00090     }
00091 
00092     virtual int serialize(unsigned char *outbuffer) const
00093     {
00094       int offset = 0;
00095       return offset;
00096     }
00097 
00098     virtual int deserialize(unsigned char *inbuffer)
00099     {
00100       int offset = 0;
00101      return offset;
00102     }
00103 
00104     const char * getType(){ return TELEPORTRELATIVE; };
00105     const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00106 
00107   };
00108 
00109   class TeleportRelative {
00110     public:
00111     typedef TeleportRelativeRequest Request;
00112     typedef TeleportRelativeResponse Response;
00113   };
00114 
00115 }
00116 #endif