Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Committer:
jvfausto
Date:
Fri Nov 02 21:48:22 2018 +0000
Revision:
2:ab8333331642
Parent:
0:9e9b7db60fd5
Working towards twists

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_sensor_msgs_Imu_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_sensor_msgs_Imu_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8 #include "std_msgs/Header.h"
garyservin 0:9e9b7db60fd5 9 #include "geometry_msgs/Quaternion.h"
garyservin 0:9e9b7db60fd5 10 #include "geometry_msgs/Vector3.h"
garyservin 0:9e9b7db60fd5 11
garyservin 0:9e9b7db60fd5 12 namespace sensor_msgs
garyservin 0:9e9b7db60fd5 13 {
garyservin 0:9e9b7db60fd5 14
garyservin 0:9e9b7db60fd5 15 class Imu : public ros::Msg
garyservin 0:9e9b7db60fd5 16 {
garyservin 0:9e9b7db60fd5 17 public:
garyservin 0:9e9b7db60fd5 18 typedef std_msgs::Header _header_type;
garyservin 0:9e9b7db60fd5 19 _header_type header;
garyservin 0:9e9b7db60fd5 20 typedef geometry_msgs::Quaternion _orientation_type;
garyservin 0:9e9b7db60fd5 21 _orientation_type orientation;
garyservin 0:9e9b7db60fd5 22 double orientation_covariance[9];
garyservin 0:9e9b7db60fd5 23 typedef geometry_msgs::Vector3 _angular_velocity_type;
garyservin 0:9e9b7db60fd5 24 _angular_velocity_type angular_velocity;
garyservin 0:9e9b7db60fd5 25 double angular_velocity_covariance[9];
garyservin 0:9e9b7db60fd5 26 typedef geometry_msgs::Vector3 _linear_acceleration_type;
garyservin 0:9e9b7db60fd5 27 _linear_acceleration_type linear_acceleration;
garyservin 0:9e9b7db60fd5 28 double linear_acceleration_covariance[9];
garyservin 0:9e9b7db60fd5 29
garyservin 0:9e9b7db60fd5 30 Imu():
garyservin 0:9e9b7db60fd5 31 header(),
garyservin 0:9e9b7db60fd5 32 orientation(),
garyservin 0:9e9b7db60fd5 33 orientation_covariance(),
garyservin 0:9e9b7db60fd5 34 angular_velocity(),
garyservin 0:9e9b7db60fd5 35 angular_velocity_covariance(),
garyservin 0:9e9b7db60fd5 36 linear_acceleration(),
garyservin 0:9e9b7db60fd5 37 linear_acceleration_covariance()
garyservin 0:9e9b7db60fd5 38 {
garyservin 0:9e9b7db60fd5 39 }
garyservin 0:9e9b7db60fd5 40
garyservin 0:9e9b7db60fd5 41 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 42 {
garyservin 0:9e9b7db60fd5 43 int offset = 0;
garyservin 0:9e9b7db60fd5 44 offset += this->header.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 45 offset += this->orientation.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 46 for( uint32_t i = 0; i < 9; i++){
garyservin 0:9e9b7db60fd5 47 union {
garyservin 0:9e9b7db60fd5 48 double real;
garyservin 0:9e9b7db60fd5 49 uint64_t base;
garyservin 0:9e9b7db60fd5 50 } u_orientation_covariancei;
garyservin 0:9e9b7db60fd5 51 u_orientation_covariancei.real = this->orientation_covariance[i];
garyservin 0:9e9b7db60fd5 52 *(outbuffer + offset + 0) = (u_orientation_covariancei.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 53 *(outbuffer + offset + 1) = (u_orientation_covariancei.base >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 54 *(outbuffer + offset + 2) = (u_orientation_covariancei.base >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 55 *(outbuffer + offset + 3) = (u_orientation_covariancei.base >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 56 *(outbuffer + offset + 4) = (u_orientation_covariancei.base >> (8 * 4)) & 0xFF;
garyservin 0:9e9b7db60fd5 57 *(outbuffer + offset + 5) = (u_orientation_covariancei.base >> (8 * 5)) & 0xFF;
garyservin 0:9e9b7db60fd5 58 *(outbuffer + offset + 6) = (u_orientation_covariancei.base >> (8 * 6)) & 0xFF;
garyservin 0:9e9b7db60fd5 59 *(outbuffer + offset + 7) = (u_orientation_covariancei.base >> (8 * 7)) & 0xFF;
garyservin 0:9e9b7db60fd5 60 offset += sizeof(this->orientation_covariance[i]);
garyservin 0:9e9b7db60fd5 61 }
garyservin 0:9e9b7db60fd5 62 offset += this->angular_velocity.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 63 for( uint32_t i = 0; i < 9; i++){
garyservin 0:9e9b7db60fd5 64 union {
garyservin 0:9e9b7db60fd5 65 double real;
garyservin 0:9e9b7db60fd5 66 uint64_t base;
garyservin 0:9e9b7db60fd5 67 } u_angular_velocity_covariancei;
garyservin 0:9e9b7db60fd5 68 u_angular_velocity_covariancei.real = this->angular_velocity_covariance[i];
garyservin 0:9e9b7db60fd5 69 *(outbuffer + offset + 0) = (u_angular_velocity_covariancei.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 70 *(outbuffer + offset + 1) = (u_angular_velocity_covariancei.base >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 71 *(outbuffer + offset + 2) = (u_angular_velocity_covariancei.base >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 72 *(outbuffer + offset + 3) = (u_angular_velocity_covariancei.base >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 73 *(outbuffer + offset + 4) = (u_angular_velocity_covariancei.base >> (8 * 4)) & 0xFF;
garyservin 0:9e9b7db60fd5 74 *(outbuffer + offset + 5) = (u_angular_velocity_covariancei.base >> (8 * 5)) & 0xFF;
garyservin 0:9e9b7db60fd5 75 *(outbuffer + offset + 6) = (u_angular_velocity_covariancei.base >> (8 * 6)) & 0xFF;
garyservin 0:9e9b7db60fd5 76 *(outbuffer + offset + 7) = (u_angular_velocity_covariancei.base >> (8 * 7)) & 0xFF;
garyservin 0:9e9b7db60fd5 77 offset += sizeof(this->angular_velocity_covariance[i]);
garyservin 0:9e9b7db60fd5 78 }
garyservin 0:9e9b7db60fd5 79 offset += this->linear_acceleration.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 80 for( uint32_t i = 0; i < 9; i++){
garyservin 0:9e9b7db60fd5 81 union {
garyservin 0:9e9b7db60fd5 82 double real;
garyservin 0:9e9b7db60fd5 83 uint64_t base;
garyservin 0:9e9b7db60fd5 84 } u_linear_acceleration_covariancei;
garyservin 0:9e9b7db60fd5 85 u_linear_acceleration_covariancei.real = this->linear_acceleration_covariance[i];
garyservin 0:9e9b7db60fd5 86 *(outbuffer + offset + 0) = (u_linear_acceleration_covariancei.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 87 *(outbuffer + offset + 1) = (u_linear_acceleration_covariancei.base >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 88 *(outbuffer + offset + 2) = (u_linear_acceleration_covariancei.base >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 89 *(outbuffer + offset + 3) = (u_linear_acceleration_covariancei.base >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 90 *(outbuffer + offset + 4) = (u_linear_acceleration_covariancei.base >> (8 * 4)) & 0xFF;
garyservin 0:9e9b7db60fd5 91 *(outbuffer + offset + 5) = (u_linear_acceleration_covariancei.base >> (8 * 5)) & 0xFF;
garyservin 0:9e9b7db60fd5 92 *(outbuffer + offset + 6) = (u_linear_acceleration_covariancei.base >> (8 * 6)) & 0xFF;
garyservin 0:9e9b7db60fd5 93 *(outbuffer + offset + 7) = (u_linear_acceleration_covariancei.base >> (8 * 7)) & 0xFF;
garyservin 0:9e9b7db60fd5 94 offset += sizeof(this->linear_acceleration_covariance[i]);
garyservin 0:9e9b7db60fd5 95 }
garyservin 0:9e9b7db60fd5 96 return offset;
garyservin 0:9e9b7db60fd5 97 }
garyservin 0:9e9b7db60fd5 98
garyservin 0:9e9b7db60fd5 99 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 100 {
garyservin 0:9e9b7db60fd5 101 int offset = 0;
garyservin 0:9e9b7db60fd5 102 offset += this->header.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 103 offset += this->orientation.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 104 for( uint32_t i = 0; i < 9; i++){
garyservin 0:9e9b7db60fd5 105 union {
garyservin 0:9e9b7db60fd5 106 double real;
garyservin 0:9e9b7db60fd5 107 uint64_t base;
garyservin 0:9e9b7db60fd5 108 } u_orientation_covariancei;
garyservin 0:9e9b7db60fd5 109 u_orientation_covariancei.base = 0;
garyservin 0:9e9b7db60fd5 110 u_orientation_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 111 u_orientation_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 112 u_orientation_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 113 u_orientation_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 114 u_orientation_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:9e9b7db60fd5 115 u_orientation_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:9e9b7db60fd5 116 u_orientation_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:9e9b7db60fd5 117 u_orientation_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:9e9b7db60fd5 118 this->orientation_covariance[i] = u_orientation_covariancei.real;
garyservin 0:9e9b7db60fd5 119 offset += sizeof(this->orientation_covariance[i]);
garyservin 0:9e9b7db60fd5 120 }
garyservin 0:9e9b7db60fd5 121 offset += this->angular_velocity.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 122 for( uint32_t i = 0; i < 9; i++){
garyservin 0:9e9b7db60fd5 123 union {
garyservin 0:9e9b7db60fd5 124 double real;
garyservin 0:9e9b7db60fd5 125 uint64_t base;
garyservin 0:9e9b7db60fd5 126 } u_angular_velocity_covariancei;
garyservin 0:9e9b7db60fd5 127 u_angular_velocity_covariancei.base = 0;
garyservin 0:9e9b7db60fd5 128 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 129 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 130 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 131 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 132 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:9e9b7db60fd5 133 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:9e9b7db60fd5 134 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:9e9b7db60fd5 135 u_angular_velocity_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:9e9b7db60fd5 136 this->angular_velocity_covariance[i] = u_angular_velocity_covariancei.real;
garyservin 0:9e9b7db60fd5 137 offset += sizeof(this->angular_velocity_covariance[i]);
garyservin 0:9e9b7db60fd5 138 }
garyservin 0:9e9b7db60fd5 139 offset += this->linear_acceleration.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 140 for( uint32_t i = 0; i < 9; i++){
garyservin 0:9e9b7db60fd5 141 union {
garyservin 0:9e9b7db60fd5 142 double real;
garyservin 0:9e9b7db60fd5 143 uint64_t base;
garyservin 0:9e9b7db60fd5 144 } u_linear_acceleration_covariancei;
garyservin 0:9e9b7db60fd5 145 u_linear_acceleration_covariancei.base = 0;
garyservin 0:9e9b7db60fd5 146 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 147 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 148 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 149 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 150 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:9e9b7db60fd5 151 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:9e9b7db60fd5 152 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:9e9b7db60fd5 153 u_linear_acceleration_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:9e9b7db60fd5 154 this->linear_acceleration_covariance[i] = u_linear_acceleration_covariancei.real;
garyservin 0:9e9b7db60fd5 155 offset += sizeof(this->linear_acceleration_covariance[i]);
garyservin 0:9e9b7db60fd5 156 }
garyservin 0:9e9b7db60fd5 157 return offset;
garyservin 0:9e9b7db60fd5 158 }
garyservin 0:9e9b7db60fd5 159
garyservin 0:9e9b7db60fd5 160 const char * getType(){ return "sensor_msgs/Imu"; };
garyservin 0:9e9b7db60fd5 161 const char * getMD5(){ return "6a62c6daae103f4ff57a132d6f95cec2"; };
garyservin 0:9e9b7db60fd5 162
garyservin 0:9e9b7db60fd5 163 };
garyservin 0:9e9b7db60fd5 164
garyservin 0:9e9b7db60fd5 165 }
garyservin 0:9e9b7db60fd5 166 #endif