Go to the documentation of this file.00001 #ifndef _ROS_rosabridge_msgs_Imu_h
00002 #define _ROS_rosabridge_msgs_Imu_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 "rosabridge_msgs/Quaternion.h"
00010 #include "rosabridge_msgs/Vector3.h"
00011
00012 namespace rosabridge_msgs
00013 {
00014
00015 class Imu : public ros::Msg
00016 {
00017 public:
00018 std_msgs::Header header;
00019 rosabridge_msgs::Quaternion orientation;
00020 float orientation_covariance[3];
00021 rosabridge_msgs::Vector3 angular_velocity;
00022 float angular_velocity_covariance[3];
00023 rosabridge_msgs::Vector3 linear_acceleration;
00024 float linear_acceleration_covariance[3];
00025
00026 virtual int serialize(unsigned char *outbuffer) const
00027 {
00028 int offset = 0;
00029 offset += this->header.serialize(outbuffer + offset);
00030 offset += this->orientation.serialize(outbuffer + offset);
00031 for( uint8_t i = 0; i < 3; i++){
00032 union {
00033 float real;
00034 uint32_t base;
00035 } u_orientation_covariancei;
00036 u_orientation_covariancei.real = this->orientation_covariance[i];
00037 *(outbuffer + offset + 0) = (u_orientation_covariancei.base >> (8 * 0)) & 0xFF;
00038 *(outbuffer + offset + 1) = (u_orientation_covariancei.base >> (8 * 1)) & 0xFF;
00039 *(outbuffer + offset + 2) = (u_orientation_covariancei.base >> (8 * 2)) & 0xFF;
00040 *(outbuffer + offset + 3) = (u_orientation_covariancei.base >> (8 * 3)) & 0xFF;
00041 offset += sizeof(this->orientation_covariance[i]);
00042 }
00043 offset += this->angular_velocity.serialize(outbuffer + offset);
00044 for( uint8_t i = 0; i < 3; i++){
00045 union {
00046 float real;
00047 uint32_t base;
00048 } u_angular_velocity_covariancei;
00049 u_angular_velocity_covariancei.real = this->angular_velocity_covariance[i];
00050 *(outbuffer + offset + 0) = (u_angular_velocity_covariancei.base >> (8 * 0)) & 0xFF;
00051 *(outbuffer + offset + 1) = (u_angular_velocity_covariancei.base >> (8 * 1)) & 0xFF;
00052 *(outbuffer + offset + 2) = (u_angular_velocity_covariancei.base >> (8 * 2)) & 0xFF;
00053 *(outbuffer + offset + 3) = (u_angular_velocity_covariancei.base >> (8 * 3)) & 0xFF;
00054 offset += sizeof(this->angular_velocity_covariance[i]);
00055 }
00056 offset += this->linear_acceleration.serialize(outbuffer + offset);
00057 for( uint8_t i = 0; i < 3; i++){
00058 union {
00059 float real;
00060 uint32_t base;
00061 } u_linear_acceleration_covariancei;
00062 u_linear_acceleration_covariancei.real = this->linear_acceleration_covariance[i];
00063 *(outbuffer + offset + 0) = (u_linear_acceleration_covariancei.base >> (8 * 0)) & 0xFF;
00064 *(outbuffer + offset + 1) = (u_linear_acceleration_covariancei.base >> (8 * 1)) & 0xFF;
00065 *(outbuffer + offset + 2) = (u_linear_acceleration_covariancei.base >> (8 * 2)) & 0xFF;
00066 *(outbuffer + offset + 3) = (u_linear_acceleration_covariancei.base >> (8 * 3)) & 0xFF;
00067 offset += sizeof(this->linear_acceleration_covariance[i]);
00068 }
00069 return offset;
00070 }
00071
00072 virtual int deserialize(unsigned char *inbuffer)
00073 {
00074 int offset = 0;
00075 offset += this->header.deserialize(inbuffer + offset);
00076 offset += this->orientation.deserialize(inbuffer + offset);
00077 for( uint8_t i = 0; i < 3; i++){
00078 union {
00079 float real;
00080 uint32_t base;
00081 } u_orientation_covariancei;
00082 u_orientation_covariancei.base = 0;
00083 u_orientation_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00084 u_orientation_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00085 u_orientation_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00086 u_orientation_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00087 this->orientation_covariance[i] = u_orientation_covariancei.real;
00088 offset += sizeof(this->orientation_covariance[i]);
00089 }
00090 offset += this->angular_velocity.deserialize(inbuffer + offset);
00091 for( uint8_t i = 0; i < 3; i++){
00092 union {
00093 float real;
00094 uint32_t base;
00095 } u_angular_velocity_covariancei;
00096 u_angular_velocity_covariancei.base = 0;
00097 u_angular_velocity_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00098 u_angular_velocity_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00099 u_angular_velocity_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00100 u_angular_velocity_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00101 this->angular_velocity_covariance[i] = u_angular_velocity_covariancei.real;
00102 offset += sizeof(this->angular_velocity_covariance[i]);
00103 }
00104 offset += this->linear_acceleration.deserialize(inbuffer + offset);
00105 for( uint8_t i = 0; i < 3; i++){
00106 union {
00107 float real;
00108 uint32_t base;
00109 } u_linear_acceleration_covariancei;
00110 u_linear_acceleration_covariancei.base = 0;
00111 u_linear_acceleration_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
00112 u_linear_acceleration_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00113 u_linear_acceleration_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00114 u_linear_acceleration_covariancei.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00115 this->linear_acceleration_covariance[i] = u_linear_acceleration_covariancei.real;
00116 offset += sizeof(this->linear_acceleration_covariance[i]);
00117 }
00118 return offset;
00119 }
00120
00121 const char * getType(){ return "rosabridge_msgs/Imu"; };
00122 const char * getMD5(){ return "405bc597f2f6eccbf0e76dfd3afd90ed"; };
00123
00124 };
00125
00126 }
00127 #endif