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_Range_h
Jeonghoon 3:2a3664dc6634 2 #define _ROS_sensor_msgs_Range_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 Range : 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 uint8_t _radiation_type_type;
Jeonghoon 3:2a3664dc6634 19 _radiation_type_type radiation_type;
Jeonghoon 3:2a3664dc6634 20 typedef float _field_of_view_type;
Jeonghoon 3:2a3664dc6634 21 _field_of_view_type field_of_view;
Jeonghoon 3:2a3664dc6634 22 typedef float _min_range_type;
Jeonghoon 3:2a3664dc6634 23 _min_range_type min_range;
Jeonghoon 3:2a3664dc6634 24 typedef float _max_range_type;
Jeonghoon 3:2a3664dc6634 25 _max_range_type max_range;
Jeonghoon 3:2a3664dc6634 26 typedef float _range_type;
Jeonghoon 3:2a3664dc6634 27 _range_type range;
Jeonghoon 3:2a3664dc6634 28 enum { ULTRASOUND = 0 };
Jeonghoon 3:2a3664dc6634 29 enum { INFRARED = 1 };
Jeonghoon 3:2a3664dc6634 30
Jeonghoon 3:2a3664dc6634 31 Range():
Jeonghoon 3:2a3664dc6634 32 header(),
Jeonghoon 3:2a3664dc6634 33 radiation_type(0),
Jeonghoon 3:2a3664dc6634 34 field_of_view(0),
Jeonghoon 3:2a3664dc6634 35 min_range(0),
Jeonghoon 3:2a3664dc6634 36 max_range(0),
Jeonghoon 3:2a3664dc6634 37 range(0)
Jeonghoon 3:2a3664dc6634 38 {
Jeonghoon 3:2a3664dc6634 39 }
Jeonghoon 3:2a3664dc6634 40
Jeonghoon 3:2a3664dc6634 41 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 3:2a3664dc6634 42 {
Jeonghoon 3:2a3664dc6634 43 int offset = 0;
Jeonghoon 3:2a3664dc6634 44 offset += this->header.serialize(outbuffer + offset);
Jeonghoon 3:2a3664dc6634 45 *(outbuffer + offset + 0) = (this->radiation_type >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 46 offset += sizeof(this->radiation_type);
Jeonghoon 3:2a3664dc6634 47 union {
Jeonghoon 3:2a3664dc6634 48 float real;
Jeonghoon 3:2a3664dc6634 49 uint32_t base;
Jeonghoon 3:2a3664dc6634 50 } u_field_of_view;
Jeonghoon 3:2a3664dc6634 51 u_field_of_view.real = this->field_of_view;
Jeonghoon 3:2a3664dc6634 52 *(outbuffer + offset + 0) = (u_field_of_view.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 53 *(outbuffer + offset + 1) = (u_field_of_view.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 54 *(outbuffer + offset + 2) = (u_field_of_view.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 55 *(outbuffer + offset + 3) = (u_field_of_view.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 56 offset += sizeof(this->field_of_view);
Jeonghoon 3:2a3664dc6634 57 union {
Jeonghoon 3:2a3664dc6634 58 float real;
Jeonghoon 3:2a3664dc6634 59 uint32_t base;
Jeonghoon 3:2a3664dc6634 60 } u_min_range;
Jeonghoon 3:2a3664dc6634 61 u_min_range.real = this->min_range;
Jeonghoon 3:2a3664dc6634 62 *(outbuffer + offset + 0) = (u_min_range.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 63 *(outbuffer + offset + 1) = (u_min_range.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 64 *(outbuffer + offset + 2) = (u_min_range.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 65 *(outbuffer + offset + 3) = (u_min_range.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 66 offset += sizeof(this->min_range);
Jeonghoon 3:2a3664dc6634 67 union {
Jeonghoon 3:2a3664dc6634 68 float real;
Jeonghoon 3:2a3664dc6634 69 uint32_t base;
Jeonghoon 3:2a3664dc6634 70 } u_max_range;
Jeonghoon 3:2a3664dc6634 71 u_max_range.real = this->max_range;
Jeonghoon 3:2a3664dc6634 72 *(outbuffer + offset + 0) = (u_max_range.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 73 *(outbuffer + offset + 1) = (u_max_range.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 74 *(outbuffer + offset + 2) = (u_max_range.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 75 *(outbuffer + offset + 3) = (u_max_range.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 76 offset += sizeof(this->max_range);
Jeonghoon 3:2a3664dc6634 77 union {
Jeonghoon 3:2a3664dc6634 78 float real;
Jeonghoon 3:2a3664dc6634 79 uint32_t base;
Jeonghoon 3:2a3664dc6634 80 } u_range;
Jeonghoon 3:2a3664dc6634 81 u_range.real = this->range;
Jeonghoon 3:2a3664dc6634 82 *(outbuffer + offset + 0) = (u_range.base >> (8 * 0)) & 0xFF;
Jeonghoon 3:2a3664dc6634 83 *(outbuffer + offset + 1) = (u_range.base >> (8 * 1)) & 0xFF;
Jeonghoon 3:2a3664dc6634 84 *(outbuffer + offset + 2) = (u_range.base >> (8 * 2)) & 0xFF;
Jeonghoon 3:2a3664dc6634 85 *(outbuffer + offset + 3) = (u_range.base >> (8 * 3)) & 0xFF;
Jeonghoon 3:2a3664dc6634 86 offset += sizeof(this->range);
Jeonghoon 3:2a3664dc6634 87 return offset;
Jeonghoon 3:2a3664dc6634 88 }
Jeonghoon 3:2a3664dc6634 89
Jeonghoon 3:2a3664dc6634 90 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 3:2a3664dc6634 91 {
Jeonghoon 3:2a3664dc6634 92 int offset = 0;
Jeonghoon 3:2a3664dc6634 93 offset += this->header.deserialize(inbuffer + offset);
Jeonghoon 3:2a3664dc6634 94 this->radiation_type = ((uint8_t) (*(inbuffer + offset)));
Jeonghoon 3:2a3664dc6634 95 offset += sizeof(this->radiation_type);
Jeonghoon 3:2a3664dc6634 96 union {
Jeonghoon 3:2a3664dc6634 97 float real;
Jeonghoon 3:2a3664dc6634 98 uint32_t base;
Jeonghoon 3:2a3664dc6634 99 } u_field_of_view;
Jeonghoon 3:2a3664dc6634 100 u_field_of_view.base = 0;
Jeonghoon 3:2a3664dc6634 101 u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 102 u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 103 u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 104 u_field_of_view.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 105 this->field_of_view = u_field_of_view.real;
Jeonghoon 3:2a3664dc6634 106 offset += sizeof(this->field_of_view);
Jeonghoon 3:2a3664dc6634 107 union {
Jeonghoon 3:2a3664dc6634 108 float real;
Jeonghoon 3:2a3664dc6634 109 uint32_t base;
Jeonghoon 3:2a3664dc6634 110 } u_min_range;
Jeonghoon 3:2a3664dc6634 111 u_min_range.base = 0;
Jeonghoon 3:2a3664dc6634 112 u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 113 u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 114 u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 115 u_min_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 116 this->min_range = u_min_range.real;
Jeonghoon 3:2a3664dc6634 117 offset += sizeof(this->min_range);
Jeonghoon 3:2a3664dc6634 118 union {
Jeonghoon 3:2a3664dc6634 119 float real;
Jeonghoon 3:2a3664dc6634 120 uint32_t base;
Jeonghoon 3:2a3664dc6634 121 } u_max_range;
Jeonghoon 3:2a3664dc6634 122 u_max_range.base = 0;
Jeonghoon 3:2a3664dc6634 123 u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 124 u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 125 u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 126 u_max_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 127 this->max_range = u_max_range.real;
Jeonghoon 3:2a3664dc6634 128 offset += sizeof(this->max_range);
Jeonghoon 3:2a3664dc6634 129 union {
Jeonghoon 3:2a3664dc6634 130 float real;
Jeonghoon 3:2a3664dc6634 131 uint32_t base;
Jeonghoon 3:2a3664dc6634 132 } u_range;
Jeonghoon 3:2a3664dc6634 133 u_range.base = 0;
Jeonghoon 3:2a3664dc6634 134 u_range.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
Jeonghoon 3:2a3664dc6634 135 u_range.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Jeonghoon 3:2a3664dc6634 136 u_range.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Jeonghoon 3:2a3664dc6634 137 u_range.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Jeonghoon 3:2a3664dc6634 138 this->range = u_range.real;
Jeonghoon 3:2a3664dc6634 139 offset += sizeof(this->range);
Jeonghoon 3:2a3664dc6634 140 return offset;
Jeonghoon 3:2a3664dc6634 141 }
Jeonghoon 3:2a3664dc6634 142
Jeonghoon 3:2a3664dc6634 143 const char * getType(){ return "sensor_msgs/Range"; };
Jeonghoon 3:2a3664dc6634 144 const char * getMD5(){ return "c005c34273dc426c67a020a87bc24148"; };
Jeonghoon 3:2a3664dc6634 145
Jeonghoon 3:2a3664dc6634 146 };
Jeonghoon 3:2a3664dc6634 147
Jeonghoon 3:2a3664dc6634 148 }
Jeonghoon 3:2a3664dc6634 149 #endif