Seokyong Song / ros_lib_kinetic

Dependencies:   BufferedSerial

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers hero_flipper_command.h Source File

hero_flipper_command.h

00001 #ifndef _ROS_hero_msgs_hero_flipper_command_h
00002 #define _ROS_hero_msgs_hero_flipper_command_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace hero_msgs
00010 {
00011 
00012   class hero_flipper_command : public ros::Msg
00013   {
00014     public:
00015       typedef uint8_t _RobotMode_type;
00016       _RobotMode_type RobotMode;
00017       typedef int16_t _SweepA_type;
00018       _SweepA_type SweepA;
00019       typedef int16_t _SweepB_type;
00020       _SweepB_type SweepB;
00021       typedef int16_t _WalkDelay_type;
00022       _WalkDelay_type WalkDelay;
00023       typedef int16_t _WalkWait_type;
00024       _WalkWait_type WalkWait;
00025       typedef uint8_t _StepCount_type;
00026       _StepCount_type StepCount;
00027       typedef int16_t _WalkHeading_type;
00028       _WalkHeading_type WalkHeading;
00029       typedef uint8_t _Amplitude_type;
00030       _Amplitude_type Amplitude;
00031       typedef float _Period_type;
00032       _Period_type Period;
00033       typedef uint8_t _iteration_type;
00034       _iteration_type iteration;
00035       typedef uint8_t _OffsetAngle_type;
00036       _OffsetAngle_type OffsetAngle;
00037       typedef uint8_t _LegSwingPart_type;
00038       _LegSwingPart_type LegSwingPart;
00039       typedef uint16_t _LegSwingDelay_type;
00040       _LegSwingDelay_type LegSwingDelay;
00041 
00042     hero_flipper_command():
00043       RobotMode(0),
00044       SweepA(0),
00045       SweepB(0),
00046       WalkDelay(0),
00047       WalkWait(0),
00048       StepCount(0),
00049       WalkHeading(0),
00050       Amplitude(0),
00051       Period(0),
00052       iteration(0),
00053       OffsetAngle(0),
00054       LegSwingPart(0),
00055       LegSwingDelay(0)
00056     {
00057     }
00058 
00059     virtual int serialize(unsigned char *outbuffer) const
00060     {
00061       int offset = 0;
00062       *(outbuffer + offset + 0) = (this->RobotMode >> (8 * 0)) & 0xFF;
00063       offset += sizeof(this->RobotMode);
00064       union {
00065         int16_t real;
00066         uint16_t base;
00067       } u_SweepA;
00068       u_SweepA.real = this->SweepA;
00069       *(outbuffer + offset + 0) = (u_SweepA.base >> (8 * 0)) & 0xFF;
00070       *(outbuffer + offset + 1) = (u_SweepA.base >> (8 * 1)) & 0xFF;
00071       offset += sizeof(this->SweepA);
00072       union {
00073         int16_t real;
00074         uint16_t base;
00075       } u_SweepB;
00076       u_SweepB.real = this->SweepB;
00077       *(outbuffer + offset + 0) = (u_SweepB.base >> (8 * 0)) & 0xFF;
00078       *(outbuffer + offset + 1) = (u_SweepB.base >> (8 * 1)) & 0xFF;
00079       offset += sizeof(this->SweepB);
00080       union {
00081         int16_t real;
00082         uint16_t base;
00083       } u_WalkDelay;
00084       u_WalkDelay.real = this->WalkDelay;
00085       *(outbuffer + offset + 0) = (u_WalkDelay.base >> (8 * 0)) & 0xFF;
00086       *(outbuffer + offset + 1) = (u_WalkDelay.base >> (8 * 1)) & 0xFF;
00087       offset += sizeof(this->WalkDelay);
00088       union {
00089         int16_t real;
00090         uint16_t base;
00091       } u_WalkWait;
00092       u_WalkWait.real = this->WalkWait;
00093       *(outbuffer + offset + 0) = (u_WalkWait.base >> (8 * 0)) & 0xFF;
00094       *(outbuffer + offset + 1) = (u_WalkWait.base >> (8 * 1)) & 0xFF;
00095       offset += sizeof(this->WalkWait);
00096       *(outbuffer + offset + 0) = (this->StepCount >> (8 * 0)) & 0xFF;
00097       offset += sizeof(this->StepCount);
00098       union {
00099         int16_t real;
00100         uint16_t base;
00101       } u_WalkHeading;
00102       u_WalkHeading.real = this->WalkHeading;
00103       *(outbuffer + offset + 0) = (u_WalkHeading.base >> (8 * 0)) & 0xFF;
00104       *(outbuffer + offset + 1) = (u_WalkHeading.base >> (8 * 1)) & 0xFF;
00105       offset += sizeof(this->WalkHeading);
00106       *(outbuffer + offset + 0) = (this->Amplitude >> (8 * 0)) & 0xFF;
00107       offset += sizeof(this->Amplitude);
00108       union {
00109         float real;
00110         uint32_t base;
00111       } u_Period;
00112       u_Period.real = this->Period;
00113       *(outbuffer + offset + 0) = (u_Period.base >> (8 * 0)) & 0xFF;
00114       *(outbuffer + offset + 1) = (u_Period.base >> (8 * 1)) & 0xFF;
00115       *(outbuffer + offset + 2) = (u_Period.base >> (8 * 2)) & 0xFF;
00116       *(outbuffer + offset + 3) = (u_Period.base >> (8 * 3)) & 0xFF;
00117       offset += sizeof(this->Period);
00118       *(outbuffer + offset + 0) = (this->iteration >> (8 * 0)) & 0xFF;
00119       offset += sizeof(this->iteration);
00120       *(outbuffer + offset + 0) = (this->OffsetAngle >> (8 * 0)) & 0xFF;
00121       offset += sizeof(this->OffsetAngle);
00122       *(outbuffer + offset + 0) = (this->LegSwingPart >> (8 * 0)) & 0xFF;
00123       offset += sizeof(this->LegSwingPart);
00124       *(outbuffer + offset + 0) = (this->LegSwingDelay >> (8 * 0)) & 0xFF;
00125       *(outbuffer + offset + 1) = (this->LegSwingDelay >> (8 * 1)) & 0xFF;
00126       offset += sizeof(this->LegSwingDelay);
00127       return offset;
00128     }
00129 
00130     virtual int deserialize(unsigned char *inbuffer)
00131     {
00132       int offset = 0;
00133       this->RobotMode =  ((uint8_t) (*(inbuffer + offset)));
00134       offset += sizeof(this->RobotMode);
00135       union {
00136         int16_t real;
00137         uint16_t base;
00138       } u_SweepA;
00139       u_SweepA.base = 0;
00140       u_SweepA.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00141       u_SweepA.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00142       this->SweepA = u_SweepA.real;
00143       offset += sizeof(this->SweepA);
00144       union {
00145         int16_t real;
00146         uint16_t base;
00147       } u_SweepB;
00148       u_SweepB.base = 0;
00149       u_SweepB.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00150       u_SweepB.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00151       this->SweepB = u_SweepB.real;
00152       offset += sizeof(this->SweepB);
00153       union {
00154         int16_t real;
00155         uint16_t base;
00156       } u_WalkDelay;
00157       u_WalkDelay.base = 0;
00158       u_WalkDelay.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00159       u_WalkDelay.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00160       this->WalkDelay = u_WalkDelay.real;
00161       offset += sizeof(this->WalkDelay);
00162       union {
00163         int16_t real;
00164         uint16_t base;
00165       } u_WalkWait;
00166       u_WalkWait.base = 0;
00167       u_WalkWait.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00168       u_WalkWait.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00169       this->WalkWait = u_WalkWait.real;
00170       offset += sizeof(this->WalkWait);
00171       this->StepCount =  ((uint8_t) (*(inbuffer + offset)));
00172       offset += sizeof(this->StepCount);
00173       union {
00174         int16_t real;
00175         uint16_t base;
00176       } u_WalkHeading;
00177       u_WalkHeading.base = 0;
00178       u_WalkHeading.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00179       u_WalkHeading.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00180       this->WalkHeading = u_WalkHeading.real;
00181       offset += sizeof(this->WalkHeading);
00182       this->Amplitude =  ((uint8_t) (*(inbuffer + offset)));
00183       offset += sizeof(this->Amplitude);
00184       union {
00185         float real;
00186         uint32_t base;
00187       } u_Period;
00188       u_Period.base = 0;
00189       u_Period.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00190       u_Period.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00191       u_Period.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00192       u_Period.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00193       this->Period = u_Period.real;
00194       offset += sizeof(this->Period);
00195       this->iteration =  ((uint8_t) (*(inbuffer + offset)));
00196       offset += sizeof(this->iteration);
00197       this->OffsetAngle =  ((uint8_t) (*(inbuffer + offset)));
00198       offset += sizeof(this->OffsetAngle);
00199       this->LegSwingPart =  ((uint8_t) (*(inbuffer + offset)));
00200       offset += sizeof(this->LegSwingPart);
00201       this->LegSwingDelay =  ((uint16_t) (*(inbuffer + offset)));
00202       this->LegSwingDelay |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00203       offset += sizeof(this->LegSwingDelay);
00204      return offset;
00205     }
00206 
00207     const char * getType(){ return "hero_msgs/hero_flipper_command"; };
00208     const char * getMD5(){ return "5fbfca8fff5085fed6726f12aa490760"; };
00209 
00210   };
00211 
00212 }
00213 #endif