apm_imu.h
Go to the documentation of this file.
00001 #ifndef _ROS_komodo_sensors_apm_imu_h
00002 #define _ROS_komodo_sensors_apm_imu_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_imu : public ros::Msg
00013   {
00014     public:
00015       float ax;
00016       float ay;
00017       float az;
00018       float gx;
00019       float gy;
00020       float gz;
00021       float roll;
00022       float pitch;
00023       float yaw;
00024       float heading;
00025       float mx;
00026       float my;
00027       float mz;
00028 
00029     virtual int serialize(unsigned char *outbuffer) const
00030     {
00031       int offset = 0;
00032       union {
00033         float real;
00034         uint32_t base;
00035       } u_ax;
00036       u_ax.real = this->ax;
00037       *(outbuffer + offset + 0) = (u_ax.base >> (8 * 0)) & 0xFF;
00038       *(outbuffer + offset + 1) = (u_ax.base >> (8 * 1)) & 0xFF;
00039       *(outbuffer + offset + 2) = (u_ax.base >> (8 * 2)) & 0xFF;
00040       *(outbuffer + offset + 3) = (u_ax.base >> (8 * 3)) & 0xFF;
00041       offset += sizeof(this->ax);
00042       union {
00043         float real;
00044         uint32_t base;
00045       } u_ay;
00046       u_ay.real = this->ay;
00047       *(outbuffer + offset + 0) = (u_ay.base >> (8 * 0)) & 0xFF;
00048       *(outbuffer + offset + 1) = (u_ay.base >> (8 * 1)) & 0xFF;
00049       *(outbuffer + offset + 2) = (u_ay.base >> (8 * 2)) & 0xFF;
00050       *(outbuffer + offset + 3) = (u_ay.base >> (8 * 3)) & 0xFF;
00051       offset += sizeof(this->ay);
00052       union {
00053         float real;
00054         uint32_t base;
00055       } u_az;
00056       u_az.real = this->az;
00057       *(outbuffer + offset + 0) = (u_az.base >> (8 * 0)) & 0xFF;
00058       *(outbuffer + offset + 1) = (u_az.base >> (8 * 1)) & 0xFF;
00059       *(outbuffer + offset + 2) = (u_az.base >> (8 * 2)) & 0xFF;
00060       *(outbuffer + offset + 3) = (u_az.base >> (8 * 3)) & 0xFF;
00061       offset += sizeof(this->az);
00062       union {
00063         float real;
00064         uint32_t base;
00065       } u_gx;
00066       u_gx.real = this->gx;
00067       *(outbuffer + offset + 0) = (u_gx.base >> (8 * 0)) & 0xFF;
00068       *(outbuffer + offset + 1) = (u_gx.base >> (8 * 1)) & 0xFF;
00069       *(outbuffer + offset + 2) = (u_gx.base >> (8 * 2)) & 0xFF;
00070       *(outbuffer + offset + 3) = (u_gx.base >> (8 * 3)) & 0xFF;
00071       offset += sizeof(this->gx);
00072       union {
00073         float real;
00074         uint32_t base;
00075       } u_gy;
00076       u_gy.real = this->gy;
00077       *(outbuffer + offset + 0) = (u_gy.base >> (8 * 0)) & 0xFF;
00078       *(outbuffer + offset + 1) = (u_gy.base >> (8 * 1)) & 0xFF;
00079       *(outbuffer + offset + 2) = (u_gy.base >> (8 * 2)) & 0xFF;
00080       *(outbuffer + offset + 3) = (u_gy.base >> (8 * 3)) & 0xFF;
00081       offset += sizeof(this->gy);
00082       union {
00083         float real;
00084         uint32_t base;
00085       } u_gz;
00086       u_gz.real = this->gz;
00087       *(outbuffer + offset + 0) = (u_gz.base >> (8 * 0)) & 0xFF;
00088       *(outbuffer + offset + 1) = (u_gz.base >> (8 * 1)) & 0xFF;
00089       *(outbuffer + offset + 2) = (u_gz.base >> (8 * 2)) & 0xFF;
00090       *(outbuffer + offset + 3) = (u_gz.base >> (8 * 3)) & 0xFF;
00091       offset += sizeof(this->gz);
00092       union {
00093         float real;
00094         uint32_t base;
00095       } u_roll;
00096       u_roll.real = this->roll;
00097       *(outbuffer + offset + 0) = (u_roll.base >> (8 * 0)) & 0xFF;
00098       *(outbuffer + offset + 1) = (u_roll.base >> (8 * 1)) & 0xFF;
00099       *(outbuffer + offset + 2) = (u_roll.base >> (8 * 2)) & 0xFF;
00100       *(outbuffer + offset + 3) = (u_roll.base >> (8 * 3)) & 0xFF;
00101       offset += sizeof(this->roll);
00102       union {
00103         float real;
00104         uint32_t base;
00105       } u_pitch;
00106       u_pitch.real = this->pitch;
00107       *(outbuffer + offset + 0) = (u_pitch.base >> (8 * 0)) & 0xFF;
00108       *(outbuffer + offset + 1) = (u_pitch.base >> (8 * 1)) & 0xFF;
00109       *(outbuffer + offset + 2) = (u_pitch.base >> (8 * 2)) & 0xFF;
00110       *(outbuffer + offset + 3) = (u_pitch.base >> (8 * 3)) & 0xFF;
00111       offset += sizeof(this->pitch);
00112       union {
00113         float real;
00114         uint32_t base;
00115       } u_yaw;
00116       u_yaw.real = this->yaw;
00117       *(outbuffer + offset + 0) = (u_yaw.base >> (8 * 0)) & 0xFF;
00118       *(outbuffer + offset + 1) = (u_yaw.base >> (8 * 1)) & 0xFF;
00119       *(outbuffer + offset + 2) = (u_yaw.base >> (8 * 2)) & 0xFF;
00120       *(outbuffer + offset + 3) = (u_yaw.base >> (8 * 3)) & 0xFF;
00121       offset += sizeof(this->yaw);
00122       union {
00123         float real;
00124         uint32_t base;
00125       } u_heading;
00126       u_heading.real = this->heading;
00127       *(outbuffer + offset + 0) = (u_heading.base >> (8 * 0)) & 0xFF;
00128       *(outbuffer + offset + 1) = (u_heading.base >> (8 * 1)) & 0xFF;
00129       *(outbuffer + offset + 2) = (u_heading.base >> (8 * 2)) & 0xFF;
00130       *(outbuffer + offset + 3) = (u_heading.base >> (8 * 3)) & 0xFF;
00131       offset += sizeof(this->heading);
00132       union {
00133         float real;
00134         uint32_t base;
00135       } u_mx;
00136       u_mx.real = this->mx;
00137       *(outbuffer + offset + 0) = (u_mx.base >> (8 * 0)) & 0xFF;
00138       *(outbuffer + offset + 1) = (u_mx.base >> (8 * 1)) & 0xFF;
00139       *(outbuffer + offset + 2) = (u_mx.base >> (8 * 2)) & 0xFF;
00140       *(outbuffer + offset + 3) = (u_mx.base >> (8 * 3)) & 0xFF;
00141       offset += sizeof(this->mx);
00142       union {
00143         float real;
00144         uint32_t base;
00145       } u_my;
00146       u_my.real = this->my;
00147       *(outbuffer + offset + 0) = (u_my.base >> (8 * 0)) & 0xFF;
00148       *(outbuffer + offset + 1) = (u_my.base >> (8 * 1)) & 0xFF;
00149       *(outbuffer + offset + 2) = (u_my.base >> (8 * 2)) & 0xFF;
00150       *(outbuffer + offset + 3) = (u_my.base >> (8 * 3)) & 0xFF;
00151       offset += sizeof(this->my);
00152       union {
00153         float real;
00154         uint32_t base;
00155       } u_mz;
00156       u_mz.real = this->mz;
00157       *(outbuffer + offset + 0) = (u_mz.base >> (8 * 0)) & 0xFF;
00158       *(outbuffer + offset + 1) = (u_mz.base >> (8 * 1)) & 0xFF;
00159       *(outbuffer + offset + 2) = (u_mz.base >> (8 * 2)) & 0xFF;
00160       *(outbuffer + offset + 3) = (u_mz.base >> (8 * 3)) & 0xFF;
00161       offset += sizeof(this->mz);
00162       return offset;
00163     }
00164 
00165     virtual int deserialize(unsigned char *inbuffer)
00166     {
00167       int offset = 0;
00168       union {
00169         float real;
00170         uint32_t base;
00171       } u_ax;
00172       u_ax.base = 0;
00173       u_ax.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00174       u_ax.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00175       u_ax.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00176       u_ax.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00177       this->ax = u_ax.real;
00178       offset += sizeof(this->ax);
00179       union {
00180         float real;
00181         uint32_t base;
00182       } u_ay;
00183       u_ay.base = 0;
00184       u_ay.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00185       u_ay.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00186       u_ay.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00187       u_ay.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00188       this->ay = u_ay.real;
00189       offset += sizeof(this->ay);
00190       union {
00191         float real;
00192         uint32_t base;
00193       } u_az;
00194       u_az.base = 0;
00195       u_az.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00196       u_az.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00197       u_az.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00198       u_az.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00199       this->az = u_az.real;
00200       offset += sizeof(this->az);
00201       union {
00202         float real;
00203         uint32_t base;
00204       } u_gx;
00205       u_gx.base = 0;
00206       u_gx.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00207       u_gx.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00208       u_gx.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00209       u_gx.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00210       this->gx = u_gx.real;
00211       offset += sizeof(this->gx);
00212       union {
00213         float real;
00214         uint32_t base;
00215       } u_gy;
00216       u_gy.base = 0;
00217       u_gy.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00218       u_gy.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00219       u_gy.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00220       u_gy.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00221       this->gy = u_gy.real;
00222       offset += sizeof(this->gy);
00223       union {
00224         float real;
00225         uint32_t base;
00226       } u_gz;
00227       u_gz.base = 0;
00228       u_gz.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00229       u_gz.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00230       u_gz.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00231       u_gz.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00232       this->gz = u_gz.real;
00233       offset += sizeof(this->gz);
00234       union {
00235         float real;
00236         uint32_t base;
00237       } u_roll;
00238       u_roll.base = 0;
00239       u_roll.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00240       u_roll.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00241       u_roll.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00242       u_roll.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00243       this->roll = u_roll.real;
00244       offset += sizeof(this->roll);
00245       union {
00246         float real;
00247         uint32_t base;
00248       } u_pitch;
00249       u_pitch.base = 0;
00250       u_pitch.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00251       u_pitch.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00252       u_pitch.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00253       u_pitch.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00254       this->pitch = u_pitch.real;
00255       offset += sizeof(this->pitch);
00256       union {
00257         float real;
00258         uint32_t base;
00259       } u_yaw;
00260       u_yaw.base = 0;
00261       u_yaw.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00262       u_yaw.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00263       u_yaw.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00264       u_yaw.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00265       this->yaw = u_yaw.real;
00266       offset += sizeof(this->yaw);
00267       union {
00268         float real;
00269         uint32_t base;
00270       } u_heading;
00271       u_heading.base = 0;
00272       u_heading.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00273       u_heading.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00274       u_heading.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00275       u_heading.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00276       this->heading = u_heading.real;
00277       offset += sizeof(this->heading);
00278       union {
00279         float real;
00280         uint32_t base;
00281       } u_mx;
00282       u_mx.base = 0;
00283       u_mx.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00284       u_mx.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00285       u_mx.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00286       u_mx.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00287       this->mx = u_mx.real;
00288       offset += sizeof(this->mx);
00289       union {
00290         float real;
00291         uint32_t base;
00292       } u_my;
00293       u_my.base = 0;
00294       u_my.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00295       u_my.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00296       u_my.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00297       u_my.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00298       this->my = u_my.real;
00299       offset += sizeof(this->my);
00300       union {
00301         float real;
00302         uint32_t base;
00303       } u_mz;
00304       u_mz.base = 0;
00305       u_mz.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00306       u_mz.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00307       u_mz.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00308       u_mz.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00309       this->mz = u_mz.real;
00310       offset += sizeof(this->mz);
00311      return offset;
00312     }
00313 
00314     const char * getType(){ return "komodo_sensors/apm_imu"; };
00315     const char * getMD5(){ return "13f07ef07721826d5bb32ddaf22559ad"; };
00316 
00317   };
00318 
00319 }
00320 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:49