ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AccelWithCovariance.h Source File

AccelWithCovariance.h

00001 #ifndef _ROS_geometry_msgs_AccelWithCovariance_h
00002 #define _ROS_geometry_msgs_AccelWithCovariance_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "geometry_msgs/Accel.h"
00009 
00010 namespace geometry_msgs
00011 {
00012 
00013   class AccelWithCovariance : public ros::Msg
00014   {
00015     public:
00016       geometry_msgs::Accel accel;
00017       double covariance[36];
00018 
00019     AccelWithCovariance():
00020       accel(),
00021       covariance()
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       offset += this->accel.serialize(outbuffer + offset);
00029       for( uint8_t i = 0; i < 36; i++){
00030       union {
00031         double real;
00032         uint64_t base;
00033       } u_covariancei;
00034       u_covariancei.real = this->covariance[i];
00035       *(outbuffer + offset + 0) = (u_covariancei.base >> (8 * 0)) & 0xFF;
00036       *(outbuffer + offset + 1) = (u_covariancei.base >> (8 * 1)) & 0xFF;
00037       *(outbuffer + offset + 2) = (u_covariancei.base >> (8 * 2)) & 0xFF;
00038       *(outbuffer + offset + 3) = (u_covariancei.base >> (8 * 3)) & 0xFF;
00039       *(outbuffer + offset + 4) = (u_covariancei.base >> (8 * 4)) & 0xFF;
00040       *(outbuffer + offset + 5) = (u_covariancei.base >> (8 * 5)) & 0xFF;
00041       *(outbuffer + offset + 6) = (u_covariancei.base >> (8 * 6)) & 0xFF;
00042       *(outbuffer + offset + 7) = (u_covariancei.base >> (8 * 7)) & 0xFF;
00043       offset += sizeof(this->covariance[i]);
00044       }
00045       return offset;
00046     }
00047 
00048     virtual int deserialize(unsigned char *inbuffer)
00049     {
00050       int offset = 0;
00051       offset += this->accel.deserialize(inbuffer + offset);
00052       for( uint8_t i = 0; i < 36; i++){
00053       union {
00054         double real;
00055         uint64_t base;
00056       } u_covariancei;
00057       u_covariancei.base = 0;
00058       u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00059       u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00060       u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00061       u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00062       u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00063       u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00064       u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00065       u_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00066       this->covariance[i] = u_covariancei.real;
00067       offset += sizeof(this->covariance[i]);
00068       }
00069      return offset;
00070     }
00071 
00072     const char * getType(){ return "geometry_msgs/AccelWithCovariance"; };
00073     const char * getMD5(){ return "ad5a718d699c6be72a02b8d6a139f334"; };
00074 
00075   };
00076 
00077 }
00078 #endif