lizi_status.h
Go to the documentation of this file.
00001 #ifndef _ROS_lizi_lizi_status_h
00002 #define _ROS_lizi_lizi_status_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace lizi
00010 {
00011 
00012   class lizi_status : public ros::Msg
00013   {
00014     public:
00015       uint8_t faults;
00016       float battery_voltage;
00017 
00018     virtual int serialize(unsigned char *outbuffer) const
00019     {
00020       int offset = 0;
00021       *(outbuffer + offset + 0) = (this->faults >> (8 * 0)) & 0xFF;
00022       offset += sizeof(this->faults);
00023       union {
00024         float real;
00025         uint32_t base;
00026       } u_battery_voltage;
00027       u_battery_voltage.real = this->battery_voltage;
00028       *(outbuffer + offset + 0) = (u_battery_voltage.base >> (8 * 0)) & 0xFF;
00029       *(outbuffer + offset + 1) = (u_battery_voltage.base >> (8 * 1)) & 0xFF;
00030       *(outbuffer + offset + 2) = (u_battery_voltage.base >> (8 * 2)) & 0xFF;
00031       *(outbuffer + offset + 3) = (u_battery_voltage.base >> (8 * 3)) & 0xFF;
00032       offset += sizeof(this->battery_voltage);
00033       return offset;
00034     }
00035 
00036     virtual int deserialize(unsigned char *inbuffer)
00037     {
00038       int offset = 0;
00039       this->faults =  ((uint8_t) (*(inbuffer + offset)));
00040       offset += sizeof(this->faults);
00041       union {
00042         float real;
00043         uint32_t base;
00044       } u_battery_voltage;
00045       u_battery_voltage.base = 0;
00046       u_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00047       u_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00048       u_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00049       u_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00050       this->battery_voltage = u_battery_voltage.real;
00051       offset += sizeof(this->battery_voltage);
00052      return offset;
00053     }
00054 
00055     const char * getType(){ return "lizi/lizi_status"; };
00056     const char * getMD5(){ return "f66cc2fe91fb70d2b82c88e7c03227df"; };
00057 
00058   };
00059 
00060 }
00061 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:49