ric_status.h
Go to the documentation of this file.
00001 #ifndef _ROS_ric_robot_ric_status_h
00002 #define _ROS_ric_robot_ric_status_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace ric_robot
00010 {
00011 
00012   class ric_status : public ros::Msg
00013   {
00014     public:
00015       uint8_t faults;
00016       float sensors_battery_voltage;
00017       float rover_battery_voltage;
00018 
00019     virtual int serialize(unsigned char *outbuffer) const
00020     {
00021       int offset = 0;
00022       *(outbuffer + offset + 0) = (this->faults >> (8 * 0)) & 0xFF;
00023       offset += sizeof(this->faults);
00024       union {
00025         float real;
00026         uint32_t base;
00027       } u_sensors_battery_voltage;
00028       u_sensors_battery_voltage.real = this->sensors_battery_voltage;
00029       *(outbuffer + offset + 0) = (u_sensors_battery_voltage.base >> (8 * 0)) & 0xFF;
00030       *(outbuffer + offset + 1) = (u_sensors_battery_voltage.base >> (8 * 1)) & 0xFF;
00031       *(outbuffer + offset + 2) = (u_sensors_battery_voltage.base >> (8 * 2)) & 0xFF;
00032       *(outbuffer + offset + 3) = (u_sensors_battery_voltage.base >> (8 * 3)) & 0xFF;
00033       offset += sizeof(this->sensors_battery_voltage);
00034       union {
00035         float real;
00036         uint32_t base;
00037       } u_rover_battery_voltage;
00038       u_rover_battery_voltage.real = this->rover_battery_voltage;
00039       *(outbuffer + offset + 0) = (u_rover_battery_voltage.base >> (8 * 0)) & 0xFF;
00040       *(outbuffer + offset + 1) = (u_rover_battery_voltage.base >> (8 * 1)) & 0xFF;
00041       *(outbuffer + offset + 2) = (u_rover_battery_voltage.base >> (8 * 2)) & 0xFF;
00042       *(outbuffer + offset + 3) = (u_rover_battery_voltage.base >> (8 * 3)) & 0xFF;
00043       offset += sizeof(this->rover_battery_voltage);
00044       return offset;
00045     }
00046 
00047     virtual int deserialize(unsigned char *inbuffer)
00048     {
00049       int offset = 0;
00050       this->faults =  ((uint8_t) (*(inbuffer + offset)));
00051       offset += sizeof(this->faults);
00052       union {
00053         float real;
00054         uint32_t base;
00055       } u_sensors_battery_voltage;
00056       u_sensors_battery_voltage.base = 0;
00057       u_sensors_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00058       u_sensors_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00059       u_sensors_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00060       u_sensors_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00061       this->sensors_battery_voltage = u_sensors_battery_voltage.real;
00062       offset += sizeof(this->sensors_battery_voltage);
00063       union {
00064         float real;
00065         uint32_t base;
00066       } u_rover_battery_voltage;
00067       u_rover_battery_voltage.base = 0;
00068       u_rover_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00069       u_rover_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00070       u_rover_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00071       u_rover_battery_voltage.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00072       this->rover_battery_voltage = u_rover_battery_voltage.real;
00073       offset += sizeof(this->rover_battery_voltage);
00074      return offset;
00075     }
00076 
00077     const char * getType(){ return "ric_robot/ric_status"; };
00078     const char * getMD5(){ return "67d6e73ce3006094432bbce95b6807f9"; };
00079 
00080   };
00081 
00082 }
00083 #endif


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