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


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:54