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


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:55