capstone_finish

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Tue Aug 13 05:53:22 2019 +0000
Revision:
3:2a3664dc6634
with ROS;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 3:2a3664dc6634 1 #ifndef _ROS_sensor_msgs_NavSatFix_h
Jeonghoon 3:2a3664dc6634 2 #define _ROS_sensor_msgs_NavSatFix_h
Jeonghoon 3:2a3664dc6634 3
Jeonghoon 3:2a3664dc6634 4 #include <stdint.h>
Jeonghoon 3:2a3664dc6634 5 #include <string.h>
Jeonghoon 3:2a3664dc6634 6 #include <stdlib.h>
Jeonghoon 3:2a3664dc6634 7 #include "ros/msg.h"
Jeonghoon 3:2a3664dc6634 8 #include "std_msgs/Header.h"
Jeonghoon 3:2a3664dc6634 9 #include "sensor_msgs/NavSatStatus.h"
Jeonghoon 3:2a3664dc6634 10
Jeonghoon 3:2a3664dc6634 11 namespace sensor_msgs
Jeonghoon 3:2a3664dc6634 12 {
Jeonghoon 3:2a3664dc6634 13
Jeonghoon 3:2a3664dc6634 14 class NavSatFix : public ros::Msg
Jeonghoon 3:2a3664dc6634 15 {
Jeonghoon 3:2a3664dc6634 16 public:
Jeonghoon 3:2a3664dc6634 17 typedef std_msgs::Header _header_type;
Jeonghoon 3:2a3664dc6634 18 _header_type header;
Jeonghoon 3:2a3664dc6634 19 typedef sensor_msgs::NavSatStatus _status_type;
Jeonghoon 3:2a3664dc6634 20 _status_type status;
Jeonghoon 3:2a3664dc6634 21 typedef double _latitude_type;
Jeonghoon 3:2a3664dc6634 22 _latitude_type latitude;
Jeonghoon 3:2a3664dc6634 23 typedef double _longitude_type;
Jeonghoon 3:2a3664dc6634 24 _longitude_type longitude;
Jeonghoon 3:2a3664dc6634 25 typedef double _altitude_type;
Jeonghoon 3:2a3664dc6634 26 _altitude_type altitude;
Jeonghoon 3:2a3664dc6634 27 double position_covariance[9];
Jeonghoon 3:2a3664dc6634 28 typedef uint8_t _position_covariance_type_type;
Jeonghoon 3:2a3664dc6634 29 _position_covariance_type_type position_covariance_type;
Jeonghoon 3:2a3664dc6634 30 enum { COVARIANCE_TYPE_UNKNOWN = 0 };
Jeonghoon 3:2a3664dc6634 31 enum { COVARIANCE_TYPE_APPROXIMATED = 1 };
Jeonghoon 3:2a3664dc6634 32 enum { COVARIANCE_TYPE_DIAGONAL_KNOWN = 2 };
Jeonghoon 3:2a3664dc6634 33 enum { COVARIANCE_TYPE_KNOWN = 3 };
Jeonghoon 3:2a3664dc6634 34
Jeonghoon 3:2a3664dc6634 35 NavSatFix():
Jeonghoon 3:2a3664dc6634 36 header(),
Jeonghoon 3:2a3664dc6634 37 status(),
Jeonghoon 3:2a3664dc6634 38 latitude(0),
Jeonghoon 3:2a3664dc6634 39 longitude(0),
Jeonghoon 3:2a3664dc6634 40 altitude(0),
Jeonghoon 3:2a3664dc6634 41 position_covariance(),
Jeonghoon 3:2a3664dc6634 42 position_covariance_type(0)
Jeonghoon 3:2a3664dc6634 43 {
Jeonghoon 3:2a3664dc6634 44 }
Jeonghoon 3:2a3664dc6634 45
Jeonghoon 3:2a3664dc6634 46 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 3:2a3664dc6634 47 {
Jeonghoon 3:2a3664dc6634 48 int offset = 0;
Jeonghoon 3:2a3664dc6634 49 offset += this->header.serialize(outbuffer + offset);
Jeonghoon 3:2a3664dc6634 50 offset += this->status.serialize(outbuffer + offset);
Jeonghoon 3:2a3664dc6634 51 union {
Jeonghoon 3:2a3664dc6634 52 double real;
Jeonghoon 3:2a3664dc6634 53 uint64_t base;
Jeonghoon 3:2a3664dc6634 54 } u_latitude;
Jeonghoon 3:2a3664dc6634 55 u_latitude.real = this->latitude;
Jeonghoon 3:2a3664dc6634 56 *(outbuffer + offset + 0) = (u_latitude.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 57 *(outbuffer + offset + 1) = (u_latitude.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 58 *(outbuffer + offset + 2) = (u_latitude.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 59 *(outbuffer + offset + 3) = (u_latitude.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 60 *(outbuffer + offset + 4) = (u_latitude.base >> (8 * 4)) & 0xFF;
Jeonghoon 3:2a3664dc6634 61 *(outbuffer + offset + 5) = (u_latitude.base >> (8 * 5)) & 0xFF;
Jeonghoon 3:2a3664dc6634 62 *(outbuffer + offset + 6) = (u_latitude.base >> (8 * 6)) & 0xFF;
Jeonghoon 3:2a3664dc6634 63 *(outbuffer + offset + 7) = (u_latitude.base >> (8 * 7)) & 0xFF;
Jeonghoon 3:2a3664dc6634 64 offset += sizeof(this->latitude);
Jeonghoon 3:2a3664dc6634 65 union {
Jeonghoon 3:2a3664dc6634 66 double real;
Jeonghoon 3:2a3664dc6634 67 uint64_t base;
Jeonghoon 3:2a3664dc6634 68 } u_longitude;
Jeonghoon 3:2a3664dc6634 69 u_longitude.real = this->longitude;
Jeonghoon 3:2a3664dc6634 70 *(outbuffer + offset + 0) = (u_longitude.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 71 *(outbuffer + offset + 1) = (u_longitude.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 72 *(outbuffer + offset + 2) = (u_longitude.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 73 *(outbuffer + offset + 3) = (u_longitude.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 74 *(outbuffer + offset + 4) = (u_longitude.base >> (8 * 4)) & 0xFF;
Jeonghoon 3:2a3664dc6634 75 *(outbuffer + offset + 5) = (u_longitude.base >> (8 * 5)) & 0xFF;
Jeonghoon 3:2a3664dc6634 76 *(outbuffer + offset + 6) = (u_longitude.base >> (8 * 6)) & 0xFF;
Jeonghoon 3:2a3664dc6634 77 *(outbuffer + offset + 7) = (u_longitude.base >> (8 * 7)) & 0xFF;
Jeonghoon 3:2a3664dc6634 78 offset += sizeof(this->longitude);
Jeonghoon 3:2a3664dc6634 79 union {
Jeonghoon 3:2a3664dc6634 80 double real;
Jeonghoon 3:2a3664dc6634 81 uint64_t base;
Jeonghoon 3:2a3664dc6634 82 } u_altitude;
Jeonghoon 3:2a3664dc6634 83 u_altitude.real = this->altitude;
Jeonghoon 3:2a3664dc6634 84 *(outbuffer + offset + 0) = (u_altitude.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 85 *(outbuffer + offset + 1) = (u_altitude.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 86 *(outbuffer + offset + 2) = (u_altitude.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 87 *(outbuffer + offset + 3) = (u_altitude.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 88 *(outbuffer + offset + 4) = (u_altitude.base >> (8 * 4)) & 0xFF;
Jeonghoon 3:2a3664dc6634 89 *(outbuffer + offset + 5) = (u_altitude.base >> (8 * 5)) & 0xFF;
Jeonghoon 3:2a3664dc6634 90 *(outbuffer + offset + 6) = (u_altitude.base >> (8 * 6)) & 0xFF;
Jeonghoon 3:2a3664dc6634 91 *(outbuffer + offset + 7) = (u_altitude.base >> (8 * 7)) & 0xFF;
Jeonghoon 3:2a3664dc6634 92 offset += sizeof(this->altitude);
Jeonghoon 3:2a3664dc6634 93 for( uint32_t i = 0; i < 9; i++){
Jeonghoon 3:2a3664dc6634 94 union {
Jeonghoon 3:2a3664dc6634 95 double real;
Jeonghoon 3:2a3664dc6634 96 uint64_t base;
Jeonghoon 3:2a3664dc6634 97 } u_position_covariancei;
Jeonghoon 3:2a3664dc6634 98 u_position_covariancei.real = this->position_covariance[i];
Jeonghoon 3:2a3664dc6634 99 *(outbuffer + offset + 0) = (u_position_covariancei.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 100 *(outbuffer + offset + 1) = (u_position_covariancei.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 101 *(outbuffer + offset + 2) = (u_position_covariancei.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 102 *(outbuffer + offset + 3) = (u_position_covariancei.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 103 *(outbuffer + offset + 4) = (u_position_covariancei.base >> (8 * 4)) & 0xFF;
Jeonghoon 3:2a3664dc6634 104 *(outbuffer + offset + 5) = (u_position_covariancei.base >> (8 * 5)) & 0xFF;
Jeonghoon 3:2a3664dc6634 105 *(outbuffer + offset + 6) = (u_position_covariancei.base >> (8 * 6)) & 0xFF;
Jeonghoon 3:2a3664dc6634 106 *(outbuffer + offset + 7) = (u_position_covariancei.base >> (8 * 7)) & 0xFF;
Jeonghoon 3:2a3664dc6634 107 offset += sizeof(this->position_covariance[i]);
Jeonghoon 3:2a3664dc6634 108 }
Jeonghoon 3:2a3664dc6634 109 *(outbuffer + offset + 0) = (this->position_covariance_type >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 110 offset += sizeof(this->position_covariance_type);
Jeonghoon 3:2a3664dc6634 111 return offset;
Jeonghoon 3:2a3664dc6634 112 }
Jeonghoon 3:2a3664dc6634 113
Jeonghoon 3:2a3664dc6634 114 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 3:2a3664dc6634 115 {
Jeonghoon 3:2a3664dc6634 116 int offset = 0;
Jeonghoon 3:2a3664dc6634 117 offset += this->header.deserialize(inbuffer + offset);
Jeonghoon 3:2a3664dc6634 118 offset += this->status.deserialize(inbuffer + offset);
Jeonghoon 3:2a3664dc6634 119 union {
Jeonghoon 3:2a3664dc6634 120 double real;
Jeonghoon 3:2a3664dc6634 121 uint64_t base;
Jeonghoon 3:2a3664dc6634 122 } u_latitude;
Jeonghoon 3:2a3664dc6634 123 u_latitude.base = 0;
Jeonghoon 3:2a3664dc6634 124 u_latitude.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 125 u_latitude.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 126 u_latitude.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 127 u_latitude.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 128 u_latitude.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 3:2a3664dc6634 129 u_latitude.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 3:2a3664dc6634 130 u_latitude.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 3:2a3664dc6634 131 u_latitude.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 3:2a3664dc6634 132 this->latitude = u_latitude.real;
Jeonghoon 3:2a3664dc6634 133 offset += sizeof(this->latitude);
Jeonghoon 3:2a3664dc6634 134 union {
Jeonghoon 3:2a3664dc6634 135 double real;
Jeonghoon 3:2a3664dc6634 136 uint64_t base;
Jeonghoon 3:2a3664dc6634 137 } u_longitude;
Jeonghoon 3:2a3664dc6634 138 u_longitude.base = 0;
Jeonghoon 3:2a3664dc6634 139 u_longitude.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 140 u_longitude.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 141 u_longitude.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 142 u_longitude.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 143 u_longitude.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 3:2a3664dc6634 144 u_longitude.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 3:2a3664dc6634 145 u_longitude.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 3:2a3664dc6634 146 u_longitude.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 3:2a3664dc6634 147 this->longitude = u_longitude.real;
Jeonghoon 3:2a3664dc6634 148 offset += sizeof(this->longitude);
Jeonghoon 3:2a3664dc6634 149 union {
Jeonghoon 3:2a3664dc6634 150 double real;
Jeonghoon 3:2a3664dc6634 151 uint64_t base;
Jeonghoon 3:2a3664dc6634 152 } u_altitude;
Jeonghoon 3:2a3664dc6634 153 u_altitude.base = 0;
Jeonghoon 3:2a3664dc6634 154 u_altitude.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 155 u_altitude.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 156 u_altitude.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 157 u_altitude.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 158 u_altitude.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 3:2a3664dc6634 159 u_altitude.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 3:2a3664dc6634 160 u_altitude.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 3:2a3664dc6634 161 u_altitude.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 3:2a3664dc6634 162 this->altitude = u_altitude.real;
Jeonghoon 3:2a3664dc6634 163 offset += sizeof(this->altitude);
Jeonghoon 3:2a3664dc6634 164 for( uint32_t i = 0; i < 9; i++){
Jeonghoon 3:2a3664dc6634 165 union {
Jeonghoon 3:2a3664dc6634 166 double real;
Jeonghoon 3:2a3664dc6634 167 uint64_t base;
Jeonghoon 3:2a3664dc6634 168 } u_position_covariancei;
Jeonghoon 3:2a3664dc6634 169 u_position_covariancei.base = 0;
Jeonghoon 3:2a3664dc6634 170 u_position_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 171 u_position_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 172 u_position_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 173 u_position_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 174 u_position_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 3:2a3664dc6634 175 u_position_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 3:2a3664dc6634 176 u_position_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 3:2a3664dc6634 177 u_position_covariancei.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 3:2a3664dc6634 178 this->position_covariance[i] = u_position_covariancei.real;
Jeonghoon 3:2a3664dc6634 179 offset += sizeof(this->position_covariance[i]);
Jeonghoon 3:2a3664dc6634 180 }
Jeonghoon 3:2a3664dc6634 181 this->position_covariance_type = ((uint8_t) (*(inbuffer + offset)));
Jeonghoon 3:2a3664dc6634 182 offset += sizeof(this->position_covariance_type);
Jeonghoon 3:2a3664dc6634 183 return offset;
Jeonghoon 3:2a3664dc6634 184 }
Jeonghoon 3:2a3664dc6634 185
Jeonghoon 3:2a3664dc6634 186 const char * getType(){ return "sensor_msgs/NavSatFix"; };
Jeonghoon 3:2a3664dc6634 187 const char * getMD5(){ return "2d3a8cd499b9b4a0249fb98fd05cfa48"; };
Jeonghoon 3:2a3664dc6634 188
Jeonghoon 3:2a3664dc6634 189 };
Jeonghoon 3:2a3664dc6634 190
Jeonghoon 3:2a3664dc6634 191 }
Jeonghoon 3:2a3664dc6634 192 #endif