capstone_finish

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Tue Nov 26 15:30:27 2019 +0000
Revision:
10:ca4e4062701a
Parent:
3:2a3664dc6634
capstone finish

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 3:2a3664dc6634 1 #ifndef _ROS_sensor_msgs_Temperature_h
Jeonghoon 3:2a3664dc6634 2 #define _ROS_sensor_msgs_Temperature_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
Jeonghoon 3:2a3664dc6634 10 namespace sensor_msgs
Jeonghoon 3:2a3664dc6634 11 {
Jeonghoon 3:2a3664dc6634 12
Jeonghoon 3:2a3664dc6634 13 class Temperature : public ros::Msg
Jeonghoon 3:2a3664dc6634 14 {
Jeonghoon 3:2a3664dc6634 15 public:
Jeonghoon 3:2a3664dc6634 16 typedef std_msgs::Header _header_type;
Jeonghoon 3:2a3664dc6634 17 _header_type header;
Jeonghoon 3:2a3664dc6634 18 typedef double _temperature_type;
Jeonghoon 3:2a3664dc6634 19 _temperature_type temperature;
Jeonghoon 3:2a3664dc6634 20 typedef double _variance_type;
Jeonghoon 3:2a3664dc6634 21 _variance_type variance;
Jeonghoon 3:2a3664dc6634 22
Jeonghoon 3:2a3664dc6634 23 Temperature():
Jeonghoon 3:2a3664dc6634 24 header(),
Jeonghoon 3:2a3664dc6634 25 temperature(0),
Jeonghoon 3:2a3664dc6634 26 variance(0)
Jeonghoon 3:2a3664dc6634 27 {
Jeonghoon 3:2a3664dc6634 28 }
Jeonghoon 3:2a3664dc6634 29
Jeonghoon 3:2a3664dc6634 30 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 3:2a3664dc6634 31 {
Jeonghoon 3:2a3664dc6634 32 int offset = 0;
Jeonghoon 3:2a3664dc6634 33 offset += this->header.serialize(outbuffer + offset);
Jeonghoon 3:2a3664dc6634 34 union {
Jeonghoon 3:2a3664dc6634 35 double real;
Jeonghoon 3:2a3664dc6634 36 uint64_t base;
Jeonghoon 3:2a3664dc6634 37 } u_temperature;
Jeonghoon 3:2a3664dc6634 38 u_temperature.real = this->temperature;
Jeonghoon 3:2a3664dc6634 39 *(outbuffer + offset + 0) = (u_temperature.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 40 *(outbuffer + offset + 1) = (u_temperature.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 41 *(outbuffer + offset + 2) = (u_temperature.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 42 *(outbuffer + offset + 3) = (u_temperature.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 43 *(outbuffer + offset + 4) = (u_temperature.base >> (8 * 4)) & 0xFF;
Jeonghoon 3:2a3664dc6634 44 *(outbuffer + offset + 5) = (u_temperature.base >> (8 * 5)) & 0xFF;
Jeonghoon 3:2a3664dc6634 45 *(outbuffer + offset + 6) = (u_temperature.base >> (8 * 6)) & 0xFF;
Jeonghoon 3:2a3664dc6634 46 *(outbuffer + offset + 7) = (u_temperature.base >> (8 * 7)) & 0xFF;
Jeonghoon 3:2a3664dc6634 47 offset += sizeof(this->temperature);
Jeonghoon 3:2a3664dc6634 48 union {
Jeonghoon 3:2a3664dc6634 49 double real;
Jeonghoon 3:2a3664dc6634 50 uint64_t base;
Jeonghoon 3:2a3664dc6634 51 } u_variance;
Jeonghoon 3:2a3664dc6634 52 u_variance.real = this->variance;
Jeonghoon 3:2a3664dc6634 53 *(outbuffer + offset + 0) = (u_variance.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 54 *(outbuffer + offset + 1) = (u_variance.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 55 *(outbuffer + offset + 2) = (u_variance.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 56 *(outbuffer + offset + 3) = (u_variance.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 57 *(outbuffer + offset + 4) = (u_variance.base >> (8 * 4)) & 0xFF;
Jeonghoon 3:2a3664dc6634 58 *(outbuffer + offset + 5) = (u_variance.base >> (8 * 5)) & 0xFF;
Jeonghoon 3:2a3664dc6634 59 *(outbuffer + offset + 6) = (u_variance.base >> (8 * 6)) & 0xFF;
Jeonghoon 3:2a3664dc6634 60 *(outbuffer + offset + 7) = (u_variance.base >> (8 * 7)) & 0xFF;
Jeonghoon 3:2a3664dc6634 61 offset += sizeof(this->variance);
Jeonghoon 3:2a3664dc6634 62 return offset;
Jeonghoon 3:2a3664dc6634 63 }
Jeonghoon 3:2a3664dc6634 64
Jeonghoon 3:2a3664dc6634 65 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 3:2a3664dc6634 66 {
Jeonghoon 3:2a3664dc6634 67 int offset = 0;
Jeonghoon 3:2a3664dc6634 68 offset += this->header.deserialize(inbuffer + offset);
Jeonghoon 3:2a3664dc6634 69 union {
Jeonghoon 3:2a3664dc6634 70 double real;
Jeonghoon 3:2a3664dc6634 71 uint64_t base;
Jeonghoon 3:2a3664dc6634 72 } u_temperature;
Jeonghoon 3:2a3664dc6634 73 u_temperature.base = 0;
Jeonghoon 3:2a3664dc6634 74 u_temperature.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 75 u_temperature.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 76 u_temperature.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 77 u_temperature.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 78 u_temperature.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 3:2a3664dc6634 79 u_temperature.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 3:2a3664dc6634 80 u_temperature.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 3:2a3664dc6634 81 u_temperature.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 3:2a3664dc6634 82 this->temperature = u_temperature.real;
Jeonghoon 3:2a3664dc6634 83 offset += sizeof(this->temperature);
Jeonghoon 3:2a3664dc6634 84 union {
Jeonghoon 3:2a3664dc6634 85 double real;
Jeonghoon 3:2a3664dc6634 86 uint64_t base;
Jeonghoon 3:2a3664dc6634 87 } u_variance;
Jeonghoon 3:2a3664dc6634 88 u_variance.base = 0;
Jeonghoon 3:2a3664dc6634 89 u_variance.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 90 u_variance.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 91 u_variance.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 92 u_variance.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 93 u_variance.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
Jeonghoon 3:2a3664dc6634 94 u_variance.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
Jeonghoon 3:2a3664dc6634 95 u_variance.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
Jeonghoon 3:2a3664dc6634 96 u_variance.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
Jeonghoon 3:2a3664dc6634 97 this->variance = u_variance.real;
Jeonghoon 3:2a3664dc6634 98 offset += sizeof(this->variance);
Jeonghoon 3:2a3664dc6634 99 return offset;
Jeonghoon 3:2a3664dc6634 100 }
Jeonghoon 3:2a3664dc6634 101
Jeonghoon 3:2a3664dc6634 102 const char * getType(){ return "sensor_msgs/Temperature"; };
Jeonghoon 3:2a3664dc6634 103 const char * getMD5(){ return "ff71b307acdbe7c871a5a6d7ed359100"; };
Jeonghoon 3:2a3664dc6634 104
Jeonghoon 3:2a3664dc6634 105 };
Jeonghoon 3:2a3664dc6634 106
Jeonghoon 3:2a3664dc6634 107 }
Jeonghoon 3:2a3664dc6634 108 #endif