Irfan Tito Kurniawan / ros_lib
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HilGPS.h Source File

HilGPS.h

00001 #ifndef _ROS_mavros_msgs_HilGPS_h
00002 #define _ROS_mavros_msgs_HilGPS_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "geographic_msgs/GeoPoint.h"
00010 
00011 namespace mavros_msgs
00012 {
00013 
00014   class HilGPS : public ros::Msg
00015   {
00016     public:
00017       typedef std_msgs::Header _header_type;
00018       _header_type header;
00019       typedef uint8_t _fix_type_type;
00020       _fix_type_type fix_type;
00021       typedef geographic_msgs::GeoPoint _geo_type;
00022       _geo_type geo;
00023       typedef uint16_t _eph_type;
00024       _eph_type eph;
00025       typedef uint16_t _epv_type;
00026       _epv_type epv;
00027       typedef uint16_t _vel_type;
00028       _vel_type vel;
00029       typedef int16_t _vn_type;
00030       _vn_type vn;
00031       typedef int16_t _ve_type;
00032       _ve_type ve;
00033       typedef int16_t _vd_type;
00034       _vd_type vd;
00035       typedef uint16_t _cog_type;
00036       _cog_type cog;
00037       typedef uint8_t _satellites_visible_type;
00038       _satellites_visible_type satellites_visible;
00039 
00040     HilGPS():
00041       header(),
00042       fix_type(0),
00043       geo(),
00044       eph(0),
00045       epv(0),
00046       vel(0),
00047       vn(0),
00048       ve(0),
00049       vd(0),
00050       cog(0),
00051       satellites_visible(0)
00052     {
00053     }
00054 
00055     virtual int serialize(unsigned char *outbuffer) const
00056     {
00057       int offset = 0;
00058       offset += this->header.serialize(outbuffer + offset);
00059       *(outbuffer + offset + 0) = (this->fix_type >> (8 * 0)) & 0xFF;
00060       offset += sizeof(this->fix_type);
00061       offset += this->geo.serialize(outbuffer + offset);
00062       *(outbuffer + offset + 0) = (this->eph >> (8 * 0)) & 0xFF;
00063       *(outbuffer + offset + 1) = (this->eph >> (8 * 1)) & 0xFF;
00064       offset += sizeof(this->eph);
00065       *(outbuffer + offset + 0) = (this->epv >> (8 * 0)) & 0xFF;
00066       *(outbuffer + offset + 1) = (this->epv >> (8 * 1)) & 0xFF;
00067       offset += sizeof(this->epv);
00068       *(outbuffer + offset + 0) = (this->vel >> (8 * 0)) & 0xFF;
00069       *(outbuffer + offset + 1) = (this->vel >> (8 * 1)) & 0xFF;
00070       offset += sizeof(this->vel);
00071       union {
00072         int16_t real;
00073         uint16_t base;
00074       } u_vn;
00075       u_vn.real = this->vn;
00076       *(outbuffer + offset + 0) = (u_vn.base >> (8 * 0)) & 0xFF;
00077       *(outbuffer + offset + 1) = (u_vn.base >> (8 * 1)) & 0xFF;
00078       offset += sizeof(this->vn);
00079       union {
00080         int16_t real;
00081         uint16_t base;
00082       } u_ve;
00083       u_ve.real = this->ve;
00084       *(outbuffer + offset + 0) = (u_ve.base >> (8 * 0)) & 0xFF;
00085       *(outbuffer + offset + 1) = (u_ve.base >> (8 * 1)) & 0xFF;
00086       offset += sizeof(this->ve);
00087       union {
00088         int16_t real;
00089         uint16_t base;
00090       } u_vd;
00091       u_vd.real = this->vd;
00092       *(outbuffer + offset + 0) = (u_vd.base >> (8 * 0)) & 0xFF;
00093       *(outbuffer + offset + 1) = (u_vd.base >> (8 * 1)) & 0xFF;
00094       offset += sizeof(this->vd);
00095       *(outbuffer + offset + 0) = (this->cog >> (8 * 0)) & 0xFF;
00096       *(outbuffer + offset + 1) = (this->cog >> (8 * 1)) & 0xFF;
00097       offset += sizeof(this->cog);
00098       *(outbuffer + offset + 0) = (this->satellites_visible >> (8 * 0)) & 0xFF;
00099       offset += sizeof(this->satellites_visible);
00100       return offset;
00101     }
00102 
00103     virtual int deserialize(unsigned char *inbuffer)
00104     {
00105       int offset = 0;
00106       offset += this->header.deserialize(inbuffer + offset);
00107       this->fix_type =  ((uint8_t) (*(inbuffer + offset)));
00108       offset += sizeof(this->fix_type);
00109       offset += this->geo.deserialize(inbuffer + offset);
00110       this->eph =  ((uint16_t) (*(inbuffer + offset)));
00111       this->eph |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00112       offset += sizeof(this->eph);
00113       this->epv =  ((uint16_t) (*(inbuffer + offset)));
00114       this->epv |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00115       offset += sizeof(this->epv);
00116       this->vel =  ((uint16_t) (*(inbuffer + offset)));
00117       this->vel |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00118       offset += sizeof(this->vel);
00119       union {
00120         int16_t real;
00121         uint16_t base;
00122       } u_vn;
00123       u_vn.base = 0;
00124       u_vn.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00125       u_vn.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00126       this->vn = u_vn.real;
00127       offset += sizeof(this->vn);
00128       union {
00129         int16_t real;
00130         uint16_t base;
00131       } u_ve;
00132       u_ve.base = 0;
00133       u_ve.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00134       u_ve.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00135       this->ve = u_ve.real;
00136       offset += sizeof(this->ve);
00137       union {
00138         int16_t real;
00139         uint16_t base;
00140       } u_vd;
00141       u_vd.base = 0;
00142       u_vd.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00143       u_vd.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00144       this->vd = u_vd.real;
00145       offset += sizeof(this->vd);
00146       this->cog =  ((uint16_t) (*(inbuffer + offset)));
00147       this->cog |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00148       offset += sizeof(this->cog);
00149       this->satellites_visible =  ((uint8_t) (*(inbuffer + offset)));
00150       offset += sizeof(this->satellites_visible);
00151      return offset;
00152     }
00153 
00154     const char * getType(){ return "mavros_msgs/HilGPS"; };
00155     const char * getMD5(){ return "313b3baf2319db196fa18376a4900a7b"; };
00156 
00157   };
00158 
00159 }
00160 #endif