lizi_pan_tilt.h
Go to the documentation of this file.
00001 #ifndef _ROS_lizi_lizi_pan_tilt_h
00002 #define _ROS_lizi_lizi_pan_tilt_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_pan_tilt : public ros::Msg
00013   {
00014     public:
00015       float pan_angle;
00016       float tilt_angle;
00017 
00018     virtual int serialize(unsigned char *outbuffer) const
00019     {
00020       int offset = 0;
00021       union {
00022         float real;
00023         uint32_t base;
00024       } u_pan_angle;
00025       u_pan_angle.real = this->pan_angle;
00026       *(outbuffer + offset + 0) = (u_pan_angle.base >> (8 * 0)) & 0xFF;
00027       *(outbuffer + offset + 1) = (u_pan_angle.base >> (8 * 1)) & 0xFF;
00028       *(outbuffer + offset + 2) = (u_pan_angle.base >> (8 * 2)) & 0xFF;
00029       *(outbuffer + offset + 3) = (u_pan_angle.base >> (8 * 3)) & 0xFF;
00030       offset += sizeof(this->pan_angle);
00031       union {
00032         float real;
00033         uint32_t base;
00034       } u_tilt_angle;
00035       u_tilt_angle.real = this->tilt_angle;
00036       *(outbuffer + offset + 0) = (u_tilt_angle.base >> (8 * 0)) & 0xFF;
00037       *(outbuffer + offset + 1) = (u_tilt_angle.base >> (8 * 1)) & 0xFF;
00038       *(outbuffer + offset + 2) = (u_tilt_angle.base >> (8 * 2)) & 0xFF;
00039       *(outbuffer + offset + 3) = (u_tilt_angle.base >> (8 * 3)) & 0xFF;
00040       offset += sizeof(this->tilt_angle);
00041       return offset;
00042     }
00043 
00044     virtual int deserialize(unsigned char *inbuffer)
00045     {
00046       int offset = 0;
00047       union {
00048         float real;
00049         uint32_t base;
00050       } u_pan_angle;
00051       u_pan_angle.base = 0;
00052       u_pan_angle.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00053       u_pan_angle.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00054       u_pan_angle.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00055       u_pan_angle.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00056       this->pan_angle = u_pan_angle.real;
00057       offset += sizeof(this->pan_angle);
00058       union {
00059         float real;
00060         uint32_t base;
00061       } u_tilt_angle;
00062       u_tilt_angle.base = 0;
00063       u_tilt_angle.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00064       u_tilt_angle.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00065       u_tilt_angle.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00066       u_tilt_angle.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00067       this->tilt_angle = u_tilt_angle.real;
00068       offset += sizeof(this->tilt_angle);
00069      return offset;
00070     }
00071 
00072     const char * getType(){ return "lizi/lizi_pan_tilt"; };
00073     const char * getMD5(){ return "f191de4d1f51ebd5f8f3b12305019bf6"; };
00074 
00075   };
00076 
00077 }
00078 #endif


lizi_arduino
Author(s): RoboTiCan
autogenerated on Wed Aug 26 2015 12:24:22