catchrobo2022 / Mbed 2 deprecated catchrobo2022_mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Footstep.h Source File

Footstep.h

00001 #ifndef _ROS_jsk_footstep_msgs_Footstep_h
00002 #define _ROS_jsk_footstep_msgs_Footstep_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "geometry_msgs/Pose.h"
00009 #include "ros/duration.h"
00010 #include "geometry_msgs/Vector3.h"
00011 
00012 namespace jsk_footstep_msgs
00013 {
00014 
00015   class Footstep : public ros::Msg
00016   {
00017     public:
00018       typedef uint8_t _leg_type;
00019       _leg_type leg;
00020       typedef geometry_msgs::Pose _pose_type;
00021       _pose_type pose;
00022       typedef ros::Duration _duration_type;
00023       _duration_type duration;
00024       typedef uint32_t _footstep_group_type;
00025       _footstep_group_type footstep_group;
00026       typedef geometry_msgs::Vector3 _dimensions_type;
00027       _dimensions_type dimensions;
00028       typedef geometry_msgs::Vector3 _offset_type;
00029       _offset_type offset;
00030       typedef float _swing_height_type;
00031       _swing_height_type swing_height;
00032       typedef float _cost_type;
00033       _cost_type cost;
00034       enum { RIGHT = 2 };
00035       enum { LEFT = 1 };
00036       enum { REJECTED = 3 };
00037       enum { APPROVED = 4 };
00038       enum { LLEG = 1 };
00039       enum { RLEG = 2 };
00040       enum { LARM = 5 };
00041       enum { RARM = 6 };
00042 
00043     Footstep():
00044       leg(0),
00045       pose(),
00046       duration(),
00047       footstep_group(0),
00048       dimensions(),
00049       offset(),
00050       swing_height(0),
00051       cost(0)
00052     {
00053     }
00054 
00055     virtual int serialize(unsigned char *outbuffer) const
00056     {
00057       int offset = 0;
00058       *(outbuffer + offset + 0) = (this->leg >> (8 * 0)) & 0xFF;
00059       offset += sizeof(this->leg);
00060       offset += this->pose.serialize(outbuffer + offset);
00061       *(outbuffer + offset + 0) = (this->duration.sec >> (8 * 0)) & 0xFF;
00062       *(outbuffer + offset + 1) = (this->duration.sec >> (8 * 1)) & 0xFF;
00063       *(outbuffer + offset + 2) = (this->duration.sec >> (8 * 2)) & 0xFF;
00064       *(outbuffer + offset + 3) = (this->duration.sec >> (8 * 3)) & 0xFF;
00065       offset += sizeof(this->duration.sec);
00066       *(outbuffer + offset + 0) = (this->duration.nsec >> (8 * 0)) & 0xFF;
00067       *(outbuffer + offset + 1) = (this->duration.nsec >> (8 * 1)) & 0xFF;
00068       *(outbuffer + offset + 2) = (this->duration.nsec >> (8 * 2)) & 0xFF;
00069       *(outbuffer + offset + 3) = (this->duration.nsec >> (8 * 3)) & 0xFF;
00070       offset += sizeof(this->duration.nsec);
00071       *(outbuffer + offset + 0) = (this->footstep_group >> (8 * 0)) & 0xFF;
00072       *(outbuffer + offset + 1) = (this->footstep_group >> (8 * 1)) & 0xFF;
00073       *(outbuffer + offset + 2) = (this->footstep_group >> (8 * 2)) & 0xFF;
00074       *(outbuffer + offset + 3) = (this->footstep_group >> (8 * 3)) & 0xFF;
00075       offset += sizeof(this->footstep_group);
00076       offset += this->dimensions.serialize(outbuffer + offset);
00077       offset += this->offset.serialize(outbuffer + offset);
00078       union {
00079         float real;
00080         uint32_t base;
00081       } u_swing_height;
00082       u_swing_height.real = this->swing_height;
00083       *(outbuffer + offset + 0) = (u_swing_height.base >> (8 * 0)) & 0xFF;
00084       *(outbuffer + offset + 1) = (u_swing_height.base >> (8 * 1)) & 0xFF;
00085       *(outbuffer + offset + 2) = (u_swing_height.base >> (8 * 2)) & 0xFF;
00086       *(outbuffer + offset + 3) = (u_swing_height.base >> (8 * 3)) & 0xFF;
00087       offset += sizeof(this->swing_height);
00088       union {
00089         float real;
00090         uint32_t base;
00091       } u_cost;
00092       u_cost.real = this->cost;
00093       *(outbuffer + offset + 0) = (u_cost.base >> (8 * 0)) & 0xFF;
00094       *(outbuffer + offset + 1) = (u_cost.base >> (8 * 1)) & 0xFF;
00095       *(outbuffer + offset + 2) = (u_cost.base >> (8 * 2)) & 0xFF;
00096       *(outbuffer + offset + 3) = (u_cost.base >> (8 * 3)) & 0xFF;
00097       offset += sizeof(this->cost);
00098       return offset;
00099     }
00100 
00101     virtual int deserialize(unsigned char *inbuffer)
00102     {
00103       int offset = 0;
00104       this->leg =  ((uint8_t) (*(inbuffer + offset)));
00105       offset += sizeof(this->leg);
00106       offset += this->pose.deserialize(inbuffer + offset);
00107       this->duration.sec =  ((uint32_t) (*(inbuffer + offset)));
00108       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00109       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00110       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00111       offset += sizeof(this->duration.sec);
00112       this->duration.nsec =  ((uint32_t) (*(inbuffer + offset)));
00113       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00114       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00115       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00116       offset += sizeof(this->duration.nsec);
00117       this->footstep_group =  ((uint32_t) (*(inbuffer + offset)));
00118       this->footstep_group |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00119       this->footstep_group |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00120       this->footstep_group |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00121       offset += sizeof(this->footstep_group);
00122       offset += this->dimensions.deserialize(inbuffer + offset);
00123       offset += this->offset.deserialize(inbuffer + offset);
00124       union {
00125         float real;
00126         uint32_t base;
00127       } u_swing_height;
00128       u_swing_height.base = 0;
00129       u_swing_height.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00130       u_swing_height.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00131       u_swing_height.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00132       u_swing_height.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00133       this->swing_height = u_swing_height.real;
00134       offset += sizeof(this->swing_height);
00135       union {
00136         float real;
00137         uint32_t base;
00138       } u_cost;
00139       u_cost.base = 0;
00140       u_cost.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00141       u_cost.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00142       u_cost.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00143       u_cost.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00144       this->cost = u_cost.real;
00145       offset += sizeof(this->cost);
00146      return offset;
00147     }
00148 
00149     virtual const char * getType(){ return "jsk_footstep_msgs/Footstep"; };
00150     virtual const char * getMD5(){ return "d890b275b63a90fe5f22a21e9a879971"; };
00151 
00152   };
00153 
00154 }
00155 #endif