Go to the documentation of this file.00001 #ifndef _ROS_komodo_batteries_monitor_batteries_monitor_h
00002 #define _ROS_komodo_batteries_monitor_batteries_monitor_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "ros/time.h"
00009
00010 namespace komodo_batteries_monitor
00011 {
00012
00013 class batteries_monitor : public ros::Msg
00014 {
00015 public:
00016 ros::Time pc_bat_time;
00017 float pc_bat_v;
00018 ros::Time arm_bat_time;
00019 float arm_bat_v;
00020 ros::Time rover_bat_time;
00021 float rover_bat_v;
00022
00023 virtual int serialize(unsigned char *outbuffer) const
00024 {
00025 int offset = 0;
00026 *(outbuffer + offset + 0) = (this->pc_bat_time.sec >> (8 * 0)) & 0xFF;
00027 *(outbuffer + offset + 1) = (this->pc_bat_time.sec >> (8 * 1)) & 0xFF;
00028 *(outbuffer + offset + 2) = (this->pc_bat_time.sec >> (8 * 2)) & 0xFF;
00029 *(outbuffer + offset + 3) = (this->pc_bat_time.sec >> (8 * 3)) & 0xFF;
00030 offset += sizeof(this->pc_bat_time.sec);
00031 *(outbuffer + offset + 0) = (this->pc_bat_time.nsec >> (8 * 0)) & 0xFF;
00032 *(outbuffer + offset + 1) = (this->pc_bat_time.nsec >> (8 * 1)) & 0xFF;
00033 *(outbuffer + offset + 2) = (this->pc_bat_time.nsec >> (8 * 2)) & 0xFF;
00034 *(outbuffer + offset + 3) = (this->pc_bat_time.nsec >> (8 * 3)) & 0xFF;
00035 offset += sizeof(this->pc_bat_time.nsec);
00036 union {
00037 float real;
00038 uint32_t base;
00039 } u_pc_bat_v;
00040 u_pc_bat_v.real = this->pc_bat_v;
00041 *(outbuffer + offset + 0) = (u_pc_bat_v.base >> (8 * 0)) & 0xFF;
00042 *(outbuffer + offset + 1) = (u_pc_bat_v.base >> (8 * 1)) & 0xFF;
00043 *(outbuffer + offset + 2) = (u_pc_bat_v.base >> (8 * 2)) & 0xFF;
00044 *(outbuffer + offset + 3) = (u_pc_bat_v.base >> (8 * 3)) & 0xFF;
00045 offset += sizeof(this->pc_bat_v);
00046 *(outbuffer + offset + 0) = (this->arm_bat_time.sec >> (8 * 0)) & 0xFF;
00047 *(outbuffer + offset + 1) = (this->arm_bat_time.sec >> (8 * 1)) & 0xFF;
00048 *(outbuffer + offset + 2) = (this->arm_bat_time.sec >> (8 * 2)) & 0xFF;
00049 *(outbuffer + offset + 3) = (this->arm_bat_time.sec >> (8 * 3)) & 0xFF;
00050 offset += sizeof(this->arm_bat_time.sec);
00051 *(outbuffer + offset + 0) = (this->arm_bat_time.nsec >> (8 * 0)) & 0xFF;
00052 *(outbuffer + offset + 1) = (this->arm_bat_time.nsec >> (8 * 1)) & 0xFF;
00053 *(outbuffer + offset + 2) = (this->arm_bat_time.nsec >> (8 * 2)) & 0xFF;
00054 *(outbuffer + offset + 3) = (this->arm_bat_time.nsec >> (8 * 3)) & 0xFF;
00055 offset += sizeof(this->arm_bat_time.nsec);
00056 union {
00057 float real;
00058 uint32_t base;
00059 } u_arm_bat_v;
00060 u_arm_bat_v.real = this->arm_bat_v;
00061 *(outbuffer + offset + 0) = (u_arm_bat_v.base >> (8 * 0)) & 0xFF;
00062 *(outbuffer + offset + 1) = (u_arm_bat_v.base >> (8 * 1)) & 0xFF;
00063 *(outbuffer + offset + 2) = (u_arm_bat_v.base >> (8 * 2)) & 0xFF;
00064 *(outbuffer + offset + 3) = (u_arm_bat_v.base >> (8 * 3)) & 0xFF;
00065 offset += sizeof(this->arm_bat_v);
00066 *(outbuffer + offset + 0) = (this->rover_bat_time.sec >> (8 * 0)) & 0xFF;
00067 *(outbuffer + offset + 1) = (this->rover_bat_time.sec >> (8 * 1)) & 0xFF;
00068 *(outbuffer + offset + 2) = (this->rover_bat_time.sec >> (8 * 2)) & 0xFF;
00069 *(outbuffer + offset + 3) = (this->rover_bat_time.sec >> (8 * 3)) & 0xFF;
00070 offset += sizeof(this->rover_bat_time.sec);
00071 *(outbuffer + offset + 0) = (this->rover_bat_time.nsec >> (8 * 0)) & 0xFF;
00072 *(outbuffer + offset + 1) = (this->rover_bat_time.nsec >> (8 * 1)) & 0xFF;
00073 *(outbuffer + offset + 2) = (this->rover_bat_time.nsec >> (8 * 2)) & 0xFF;
00074 *(outbuffer + offset + 3) = (this->rover_bat_time.nsec >> (8 * 3)) & 0xFF;
00075 offset += sizeof(this->rover_bat_time.nsec);
00076 union {
00077 float real;
00078 uint32_t base;
00079 } u_rover_bat_v;
00080 u_rover_bat_v.real = this->rover_bat_v;
00081 *(outbuffer + offset + 0) = (u_rover_bat_v.base >> (8 * 0)) & 0xFF;
00082 *(outbuffer + offset + 1) = (u_rover_bat_v.base >> (8 * 1)) & 0xFF;
00083 *(outbuffer + offset + 2) = (u_rover_bat_v.base >> (8 * 2)) & 0xFF;
00084 *(outbuffer + offset + 3) = (u_rover_bat_v.base >> (8 * 3)) & 0xFF;
00085 offset += sizeof(this->rover_bat_v);
00086 return offset;
00087 }
00088
00089 virtual int deserialize(unsigned char *inbuffer)
00090 {
00091 int offset = 0;
00092 this->pc_bat_time.sec = ((uint32_t) (*(inbuffer + offset)));
00093 this->pc_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00094 this->pc_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00095 this->pc_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00096 offset += sizeof(this->pc_bat_time.sec);
00097 this->pc_bat_time.nsec = ((uint32_t) (*(inbuffer + offset)));
00098 this->pc_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00099 this->pc_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00100 this->pc_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00101 offset += sizeof(this->pc_bat_time.nsec);
00102 union {
00103 float real;
00104 uint32_t base;
00105 } u_pc_bat_v;
00106 u_pc_bat_v.base = 0;
00107 u_pc_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00108 u_pc_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00109 u_pc_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00110 u_pc_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00111 this->pc_bat_v = u_pc_bat_v.real;
00112 offset += sizeof(this->pc_bat_v);
00113 this->arm_bat_time.sec = ((uint32_t) (*(inbuffer + offset)));
00114 this->arm_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00115 this->arm_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00116 this->arm_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00117 offset += sizeof(this->arm_bat_time.sec);
00118 this->arm_bat_time.nsec = ((uint32_t) (*(inbuffer + offset)));
00119 this->arm_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00120 this->arm_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00121 this->arm_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00122 offset += sizeof(this->arm_bat_time.nsec);
00123 union {
00124 float real;
00125 uint32_t base;
00126 } u_arm_bat_v;
00127 u_arm_bat_v.base = 0;
00128 u_arm_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00129 u_arm_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00130 u_arm_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00131 u_arm_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00132 this->arm_bat_v = u_arm_bat_v.real;
00133 offset += sizeof(this->arm_bat_v);
00134 this->rover_bat_time.sec = ((uint32_t) (*(inbuffer + offset)));
00135 this->rover_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00136 this->rover_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00137 this->rover_bat_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00138 offset += sizeof(this->rover_bat_time.sec);
00139 this->rover_bat_time.nsec = ((uint32_t) (*(inbuffer + offset)));
00140 this->rover_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00141 this->rover_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00142 this->rover_bat_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00143 offset += sizeof(this->rover_bat_time.nsec);
00144 union {
00145 float real;
00146 uint32_t base;
00147 } u_rover_bat_v;
00148 u_rover_bat_v.base = 0;
00149 u_rover_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00150 u_rover_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00151 u_rover_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00152 u_rover_bat_v.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00153 this->rover_bat_v = u_rover_bat_v.real;
00154 offset += sizeof(this->rover_bat_v);
00155 return offset;
00156 }
00157
00158 const char * getType(){ return "komodo_batteries_monitor/batteries_monitor"; };
00159 const char * getMD5(){ return "ec3967ff434930a33d16a16a1d3824b6"; };
00160
00161 };
00162
00163 }
00164 #endif