ROS Serial library for Mbed platforms for ROS Kinetic Kame. Check http://wiki.ros.org/rosserial_mbed/ for more information.
Dependents: mbed-os-example-blinky
std_msgs/ColorRGBA.h@2:f2240ad62eaf, 2019-08-01 (annotated)
- Committer:
- fllay
- Date:
- Thu Aug 01 17:08:55 2019 +0000
- Revision:
- 2:f2240ad62eaf
- Parent:
- 0:9e9b7db60fd5
fix time.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_std_msgs_ColorRGBA_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_std_msgs_ColorRGBA_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 | |
garyservin | 0:9e9b7db60fd5 | 9 | namespace std_msgs |
garyservin | 0:9e9b7db60fd5 | 10 | { |
garyservin | 0:9e9b7db60fd5 | 11 | |
garyservin | 0:9e9b7db60fd5 | 12 | class ColorRGBA : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 13 | { |
garyservin | 0:9e9b7db60fd5 | 14 | public: |
garyservin | 0:9e9b7db60fd5 | 15 | typedef float _r_type; |
garyservin | 0:9e9b7db60fd5 | 16 | _r_type r; |
garyservin | 0:9e9b7db60fd5 | 17 | typedef float _g_type; |
garyservin | 0:9e9b7db60fd5 | 18 | _g_type g; |
garyservin | 0:9e9b7db60fd5 | 19 | typedef float _b_type; |
garyservin | 0:9e9b7db60fd5 | 20 | _b_type b; |
garyservin | 0:9e9b7db60fd5 | 21 | typedef float _a_type; |
garyservin | 0:9e9b7db60fd5 | 22 | _a_type a; |
garyservin | 0:9e9b7db60fd5 | 23 | |
garyservin | 0:9e9b7db60fd5 | 24 | ColorRGBA(): |
garyservin | 0:9e9b7db60fd5 | 25 | r(0), |
garyservin | 0:9e9b7db60fd5 | 26 | g(0), |
garyservin | 0:9e9b7db60fd5 | 27 | b(0), |
garyservin | 0:9e9b7db60fd5 | 28 | a(0) |
garyservin | 0:9e9b7db60fd5 | 29 | { |
garyservin | 0:9e9b7db60fd5 | 30 | } |
garyservin | 0:9e9b7db60fd5 | 31 | |
garyservin | 0:9e9b7db60fd5 | 32 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 33 | { |
garyservin | 0:9e9b7db60fd5 | 34 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 35 | union { |
garyservin | 0:9e9b7db60fd5 | 36 | float real; |
garyservin | 0:9e9b7db60fd5 | 37 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 38 | } u_r; |
garyservin | 0:9e9b7db60fd5 | 39 | u_r.real = this->r; |
garyservin | 0:9e9b7db60fd5 | 40 | *(outbuffer + offset + 0) = (u_r.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 41 | *(outbuffer + offset + 1) = (u_r.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 42 | *(outbuffer + offset + 2) = (u_r.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 43 | *(outbuffer + offset + 3) = (u_r.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 44 | offset += sizeof(this->r); |
garyservin | 0:9e9b7db60fd5 | 45 | union { |
garyservin | 0:9e9b7db60fd5 | 46 | float real; |
garyservin | 0:9e9b7db60fd5 | 47 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 48 | } u_g; |
garyservin | 0:9e9b7db60fd5 | 49 | u_g.real = this->g; |
garyservin | 0:9e9b7db60fd5 | 50 | *(outbuffer + offset + 0) = (u_g.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 51 | *(outbuffer + offset + 1) = (u_g.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 52 | *(outbuffer + offset + 2) = (u_g.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 53 | *(outbuffer + offset + 3) = (u_g.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 54 | offset += sizeof(this->g); |
garyservin | 0:9e9b7db60fd5 | 55 | union { |
garyservin | 0:9e9b7db60fd5 | 56 | float real; |
garyservin | 0:9e9b7db60fd5 | 57 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 58 | } u_b; |
garyservin | 0:9e9b7db60fd5 | 59 | u_b.real = this->b; |
garyservin | 0:9e9b7db60fd5 | 60 | *(outbuffer + offset + 0) = (u_b.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 61 | *(outbuffer + offset + 1) = (u_b.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 62 | *(outbuffer + offset + 2) = (u_b.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 63 | *(outbuffer + offset + 3) = (u_b.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 64 | offset += sizeof(this->b); |
garyservin | 0:9e9b7db60fd5 | 65 | union { |
garyservin | 0:9e9b7db60fd5 | 66 | float real; |
garyservin | 0:9e9b7db60fd5 | 67 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 68 | } u_a; |
garyservin | 0:9e9b7db60fd5 | 69 | u_a.real = this->a; |
garyservin | 0:9e9b7db60fd5 | 70 | *(outbuffer + offset + 0) = (u_a.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 71 | *(outbuffer + offset + 1) = (u_a.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 72 | *(outbuffer + offset + 2) = (u_a.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 73 | *(outbuffer + offset + 3) = (u_a.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 74 | offset += sizeof(this->a); |
garyservin | 0:9e9b7db60fd5 | 75 | return offset; |
garyservin | 0:9e9b7db60fd5 | 76 | } |
garyservin | 0:9e9b7db60fd5 | 77 | |
garyservin | 0:9e9b7db60fd5 | 78 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 79 | { |
garyservin | 0:9e9b7db60fd5 | 80 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 81 | union { |
garyservin | 0:9e9b7db60fd5 | 82 | float real; |
garyservin | 0:9e9b7db60fd5 | 83 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 84 | } u_r; |
garyservin | 0:9e9b7db60fd5 | 85 | u_r.base = 0; |
garyservin | 0:9e9b7db60fd5 | 86 | u_r.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 87 | u_r.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 88 | u_r.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 89 | u_r.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 90 | this->r = u_r.real; |
garyservin | 0:9e9b7db60fd5 | 91 | offset += sizeof(this->r); |
garyservin | 0:9e9b7db60fd5 | 92 | union { |
garyservin | 0:9e9b7db60fd5 | 93 | float real; |
garyservin | 0:9e9b7db60fd5 | 94 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 95 | } u_g; |
garyservin | 0:9e9b7db60fd5 | 96 | u_g.base = 0; |
garyservin | 0:9e9b7db60fd5 | 97 | u_g.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 98 | u_g.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 99 | u_g.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 100 | u_g.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 101 | this->g = u_g.real; |
garyservin | 0:9e9b7db60fd5 | 102 | offset += sizeof(this->g); |
garyservin | 0:9e9b7db60fd5 | 103 | union { |
garyservin | 0:9e9b7db60fd5 | 104 | float real; |
garyservin | 0:9e9b7db60fd5 | 105 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 106 | } u_b; |
garyservin | 0:9e9b7db60fd5 | 107 | u_b.base = 0; |
garyservin | 0:9e9b7db60fd5 | 108 | u_b.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 109 | u_b.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 110 | u_b.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 111 | u_b.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 112 | this->b = u_b.real; |
garyservin | 0:9e9b7db60fd5 | 113 | offset += sizeof(this->b); |
garyservin | 0:9e9b7db60fd5 | 114 | union { |
garyservin | 0:9e9b7db60fd5 | 115 | float real; |
garyservin | 0:9e9b7db60fd5 | 116 | uint32_t base; |
garyservin | 0:9e9b7db60fd5 | 117 | } u_a; |
garyservin | 0:9e9b7db60fd5 | 118 | u_a.base = 0; |
garyservin | 0:9e9b7db60fd5 | 119 | u_a.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 120 | u_a.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 121 | u_a.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 122 | u_a.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 123 | this->a = u_a.real; |
garyservin | 0:9e9b7db60fd5 | 124 | offset += sizeof(this->a); |
garyservin | 0:9e9b7db60fd5 | 125 | return offset; |
garyservin | 0:9e9b7db60fd5 | 126 | } |
garyservin | 0:9e9b7db60fd5 | 127 | |
garyservin | 0:9e9b7db60fd5 | 128 | const char * getType(){ return "std_msgs/ColorRGBA"; }; |
garyservin | 0:9e9b7db60fd5 | 129 | const char * getMD5(){ return "a29a96539573343b1310c73607334b00"; }; |
garyservin | 0:9e9b7db60fd5 | 130 | |
garyservin | 0:9e9b7db60fd5 | 131 | }; |
garyservin | 0:9e9b7db60fd5 | 132 | |
garyservin | 0:9e9b7db60fd5 | 133 | } |
garyservin | 0:9e9b7db60fd5 | 134 | #endif |