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

Point32.h

00001 #ifndef _ROS_geometry_msgs_Point32_h
00002 #define _ROS_geometry_msgs_Point32_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace geometry_msgs
00010 {
00011 
00012   class Point32 : public ros::Msg
00013   {
00014     public:
00015       float x;
00016       float y;
00017       float z;
00018 
00019     Point32():
00020       x(0),
00021       y(0),
00022       z(0)
00023     {
00024     }
00025 
00026     virtual int serialize(unsigned char *outbuffer) const
00027     {
00028       int offset = 0;
00029       union {
00030         float real;
00031         uint32_t base;
00032       } u_x;
00033       u_x.real = this->x;
00034       *(outbuffer + offset + 0) = (u_x.base >> (8 * 0)) & 0xFF;
00035       *(outbuffer + offset + 1) = (u_x.base >> (8 * 1)) & 0xFF;
00036       *(outbuffer + offset + 2) = (u_x.base >> (8 * 2)) & 0xFF;
00037       *(outbuffer + offset + 3) = (u_x.base >> (8 * 3)) & 0xFF;
00038       offset += sizeof(this->x);
00039       union {
00040         float real;
00041         uint32_t base;
00042       } u_y;
00043       u_y.real = this->y;
00044       *(outbuffer + offset + 0) = (u_y.base >> (8 * 0)) & 0xFF;
00045       *(outbuffer + offset + 1) = (u_y.base >> (8 * 1)) & 0xFF;
00046       *(outbuffer + offset + 2) = (u_y.base >> (8 * 2)) & 0xFF;
00047       *(outbuffer + offset + 3) = (u_y.base >> (8 * 3)) & 0xFF;
00048       offset += sizeof(this->y);
00049       union {
00050         float real;
00051         uint32_t base;
00052       } u_z;
00053       u_z.real = this->z;
00054       *(outbuffer + offset + 0) = (u_z.base >> (8 * 0)) & 0xFF;
00055       *(outbuffer + offset + 1) = (u_z.base >> (8 * 1)) & 0xFF;
00056       *(outbuffer + offset + 2) = (u_z.base >> (8 * 2)) & 0xFF;
00057       *(outbuffer + offset + 3) = (u_z.base >> (8 * 3)) & 0xFF;
00058       offset += sizeof(this->z);
00059       return offset;
00060     }
00061 
00062     virtual int deserialize(unsigned char *inbuffer)
00063     {
00064       int offset = 0;
00065       union {
00066         float real;
00067         uint32_t base;
00068       } u_x;
00069       u_x.base = 0;
00070       u_x.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00071       u_x.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00072       u_x.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00073       u_x.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00074       this->x = u_x.real;
00075       offset += sizeof(this->x);
00076       union {
00077         float real;
00078         uint32_t base;
00079       } u_y;
00080       u_y.base = 0;
00081       u_y.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00082       u_y.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00083       u_y.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00084       u_y.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00085       this->y = u_y.real;
00086       offset += sizeof(this->y);
00087       union {
00088         float real;
00089         uint32_t base;
00090       } u_z;
00091       u_z.base = 0;
00092       u_z.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00093       u_z.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00094       u_z.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00095       u_z.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00096       this->z = u_z.real;
00097       offset += sizeof(this->z);
00098      return offset;
00099     }
00100 
00101     const char * getType(){ return "geometry_msgs/Point32"; };
00102     const char * getMD5(){ return "cc153912f1453b708d221682bc23d9ac"; };
00103 
00104   };
00105 
00106 }
00107 #endif