rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
tf2_msgs/LookupTransformGoal.h@0:30537dec6e0b, 2015-02-15 (annotated)
- Committer:
- akashvibhute
- Date:
- Sun Feb 15 10:53:43 2015 +0000
- Revision:
- 0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:30537dec6e0b | 1 | #ifndef _ROS_tf2_msgs_LookupTransformGoal_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_tf2_msgs_LookupTransformGoal_h |
akashvibhute | 0:30537dec6e0b | 3 | |
akashvibhute | 0:30537dec6e0b | 4 | #include <stdint.h> |
akashvibhute | 0:30537dec6e0b | 5 | #include <string.h> |
akashvibhute | 0:30537dec6e0b | 6 | #include <stdlib.h> |
akashvibhute | 0:30537dec6e0b | 7 | #include "ros/msg.h" |
akashvibhute | 0:30537dec6e0b | 8 | #include "ros/time.h" |
akashvibhute | 0:30537dec6e0b | 9 | #include "ros/duration.h" |
akashvibhute | 0:30537dec6e0b | 10 | |
akashvibhute | 0:30537dec6e0b | 11 | namespace tf2_msgs |
akashvibhute | 0:30537dec6e0b | 12 | { |
akashvibhute | 0:30537dec6e0b | 13 | |
akashvibhute | 0:30537dec6e0b | 14 | class LookupTransformGoal : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 15 | { |
akashvibhute | 0:30537dec6e0b | 16 | public: |
akashvibhute | 0:30537dec6e0b | 17 | const char* target_frame; |
akashvibhute | 0:30537dec6e0b | 18 | const char* source_frame; |
akashvibhute | 0:30537dec6e0b | 19 | ros::Time source_time; |
akashvibhute | 0:30537dec6e0b | 20 | ros::Duration timeout; |
akashvibhute | 0:30537dec6e0b | 21 | ros::Time target_time; |
akashvibhute | 0:30537dec6e0b | 22 | const char* fixed_frame; |
akashvibhute | 0:30537dec6e0b | 23 | bool advanced; |
akashvibhute | 0:30537dec6e0b | 24 | |
akashvibhute | 0:30537dec6e0b | 25 | LookupTransformGoal(): |
akashvibhute | 0:30537dec6e0b | 26 | target_frame(""), |
akashvibhute | 0:30537dec6e0b | 27 | source_frame(""), |
akashvibhute | 0:30537dec6e0b | 28 | source_time(), |
akashvibhute | 0:30537dec6e0b | 29 | timeout(), |
akashvibhute | 0:30537dec6e0b | 30 | target_time(), |
akashvibhute | 0:30537dec6e0b | 31 | fixed_frame(""), |
akashvibhute | 0:30537dec6e0b | 32 | advanced(0) |
akashvibhute | 0:30537dec6e0b | 33 | { |
akashvibhute | 0:30537dec6e0b | 34 | } |
akashvibhute | 0:30537dec6e0b | 35 | |
akashvibhute | 0:30537dec6e0b | 36 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 37 | { |
akashvibhute | 0:30537dec6e0b | 38 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 39 | uint32_t length_target_frame = strlen(this->target_frame); |
akashvibhute | 0:30537dec6e0b | 40 | memcpy(outbuffer + offset, &length_target_frame, sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 41 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 42 | memcpy(outbuffer + offset, this->target_frame, length_target_frame); |
akashvibhute | 0:30537dec6e0b | 43 | offset += length_target_frame; |
akashvibhute | 0:30537dec6e0b | 44 | uint32_t length_source_frame = strlen(this->source_frame); |
akashvibhute | 0:30537dec6e0b | 45 | memcpy(outbuffer + offset, &length_source_frame, sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 46 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 47 | memcpy(outbuffer + offset, this->source_frame, length_source_frame); |
akashvibhute | 0:30537dec6e0b | 48 | offset += length_source_frame; |
akashvibhute | 0:30537dec6e0b | 49 | *(outbuffer + offset + 0) = (this->source_time.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 50 | *(outbuffer + offset + 1) = (this->source_time.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 51 | *(outbuffer + offset + 2) = (this->source_time.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 52 | *(outbuffer + offset + 3) = (this->source_time.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 53 | offset += sizeof(this->source_time.sec); |
akashvibhute | 0:30537dec6e0b | 54 | *(outbuffer + offset + 0) = (this->source_time.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 55 | *(outbuffer + offset + 1) = (this->source_time.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 56 | *(outbuffer + offset + 2) = (this->source_time.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 57 | *(outbuffer + offset + 3) = (this->source_time.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 58 | offset += sizeof(this->source_time.nsec); |
akashvibhute | 0:30537dec6e0b | 59 | *(outbuffer + offset + 0) = (this->timeout.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 60 | *(outbuffer + offset + 1) = (this->timeout.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 61 | *(outbuffer + offset + 2) = (this->timeout.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 62 | *(outbuffer + offset + 3) = (this->timeout.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 63 | offset += sizeof(this->timeout.sec); |
akashvibhute | 0:30537dec6e0b | 64 | *(outbuffer + offset + 0) = (this->timeout.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 65 | *(outbuffer + offset + 1) = (this->timeout.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 66 | *(outbuffer + offset + 2) = (this->timeout.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 67 | *(outbuffer + offset + 3) = (this->timeout.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 68 | offset += sizeof(this->timeout.nsec); |
akashvibhute | 0:30537dec6e0b | 69 | *(outbuffer + offset + 0) = (this->target_time.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 70 | *(outbuffer + offset + 1) = (this->target_time.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 71 | *(outbuffer + offset + 2) = (this->target_time.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 72 | *(outbuffer + offset + 3) = (this->target_time.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 73 | offset += sizeof(this->target_time.sec); |
akashvibhute | 0:30537dec6e0b | 74 | *(outbuffer + offset + 0) = (this->target_time.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 75 | *(outbuffer + offset + 1) = (this->target_time.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 76 | *(outbuffer + offset + 2) = (this->target_time.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 77 | *(outbuffer + offset + 3) = (this->target_time.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 78 | offset += sizeof(this->target_time.nsec); |
akashvibhute | 0:30537dec6e0b | 79 | uint32_t length_fixed_frame = strlen(this->fixed_frame); |
akashvibhute | 0:30537dec6e0b | 80 | memcpy(outbuffer + offset, &length_fixed_frame, sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 81 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 82 | memcpy(outbuffer + offset, this->fixed_frame, length_fixed_frame); |
akashvibhute | 0:30537dec6e0b | 83 | offset += length_fixed_frame; |
akashvibhute | 0:30537dec6e0b | 84 | union { |
akashvibhute | 0:30537dec6e0b | 85 | bool real; |
akashvibhute | 0:30537dec6e0b | 86 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 87 | } u_advanced; |
akashvibhute | 0:30537dec6e0b | 88 | u_advanced.real = this->advanced; |
akashvibhute | 0:30537dec6e0b | 89 | *(outbuffer + offset + 0) = (u_advanced.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 90 | offset += sizeof(this->advanced); |
akashvibhute | 0:30537dec6e0b | 91 | return offset; |
akashvibhute | 0:30537dec6e0b | 92 | } |
akashvibhute | 0:30537dec6e0b | 93 | |
akashvibhute | 0:30537dec6e0b | 94 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 95 | { |
akashvibhute | 0:30537dec6e0b | 96 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 97 | uint32_t length_target_frame; |
akashvibhute | 0:30537dec6e0b | 98 | memcpy(&length_target_frame, (inbuffer + offset), sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 99 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 100 | for(unsigned int k= offset; k< offset+length_target_frame; ++k){ |
akashvibhute | 0:30537dec6e0b | 101 | inbuffer[k-1]=inbuffer[k]; |
akashvibhute | 0:30537dec6e0b | 102 | } |
akashvibhute | 0:30537dec6e0b | 103 | inbuffer[offset+length_target_frame-1]=0; |
akashvibhute | 0:30537dec6e0b | 104 | this->target_frame = (char *)(inbuffer + offset-1); |
akashvibhute | 0:30537dec6e0b | 105 | offset += length_target_frame; |
akashvibhute | 0:30537dec6e0b | 106 | uint32_t length_source_frame; |
akashvibhute | 0:30537dec6e0b | 107 | memcpy(&length_source_frame, (inbuffer + offset), sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 108 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 109 | for(unsigned int k= offset; k< offset+length_source_frame; ++k){ |
akashvibhute | 0:30537dec6e0b | 110 | inbuffer[k-1]=inbuffer[k]; |
akashvibhute | 0:30537dec6e0b | 111 | } |
akashvibhute | 0:30537dec6e0b | 112 | inbuffer[offset+length_source_frame-1]=0; |
akashvibhute | 0:30537dec6e0b | 113 | this->source_frame = (char *)(inbuffer + offset-1); |
akashvibhute | 0:30537dec6e0b | 114 | offset += length_source_frame; |
akashvibhute | 0:30537dec6e0b | 115 | this->source_time.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 116 | this->source_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 117 | this->source_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 118 | this->source_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 119 | offset += sizeof(this->source_time.sec); |
akashvibhute | 0:30537dec6e0b | 120 | this->source_time.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 121 | this->source_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 122 | this->source_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 123 | this->source_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 124 | offset += sizeof(this->source_time.nsec); |
akashvibhute | 0:30537dec6e0b | 125 | this->timeout.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 126 | this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 127 | this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 128 | this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 129 | offset += sizeof(this->timeout.sec); |
akashvibhute | 0:30537dec6e0b | 130 | this->timeout.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 131 | this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 132 | this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 133 | this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 134 | offset += sizeof(this->timeout.nsec); |
akashvibhute | 0:30537dec6e0b | 135 | this->target_time.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 136 | this->target_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 137 | this->target_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 138 | this->target_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 139 | offset += sizeof(this->target_time.sec); |
akashvibhute | 0:30537dec6e0b | 140 | this->target_time.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 141 | this->target_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 142 | this->target_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 143 | this->target_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 144 | offset += sizeof(this->target_time.nsec); |
akashvibhute | 0:30537dec6e0b | 145 | uint32_t length_fixed_frame; |
akashvibhute | 0:30537dec6e0b | 146 | memcpy(&length_fixed_frame, (inbuffer + offset), sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 147 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 148 | for(unsigned int k= offset; k< offset+length_fixed_frame; ++k){ |
akashvibhute | 0:30537dec6e0b | 149 | inbuffer[k-1]=inbuffer[k]; |
akashvibhute | 0:30537dec6e0b | 150 | } |
akashvibhute | 0:30537dec6e0b | 151 | inbuffer[offset+length_fixed_frame-1]=0; |
akashvibhute | 0:30537dec6e0b | 152 | this->fixed_frame = (char *)(inbuffer + offset-1); |
akashvibhute | 0:30537dec6e0b | 153 | offset += length_fixed_frame; |
akashvibhute | 0:30537dec6e0b | 154 | union { |
akashvibhute | 0:30537dec6e0b | 155 | bool real; |
akashvibhute | 0:30537dec6e0b | 156 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 157 | } u_advanced; |
akashvibhute | 0:30537dec6e0b | 158 | u_advanced.base = 0; |
akashvibhute | 0:30537dec6e0b | 159 | u_advanced.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 160 | this->advanced = u_advanced.real; |
akashvibhute | 0:30537dec6e0b | 161 | offset += sizeof(this->advanced); |
akashvibhute | 0:30537dec6e0b | 162 | return offset; |
akashvibhute | 0:30537dec6e0b | 163 | } |
akashvibhute | 0:30537dec6e0b | 164 | |
akashvibhute | 0:30537dec6e0b | 165 | const char * getType(){ return "tf2_msgs/LookupTransformGoal"; }; |
akashvibhute | 0:30537dec6e0b | 166 | const char * getMD5(){ return "35e3720468131d675a18bb6f3e5f22f8"; }; |
akashvibhute | 0:30537dec6e0b | 167 | |
akashvibhute | 0:30537dec6e0b | 168 | }; |
akashvibhute | 0:30537dec6e0b | 169 | |
akashvibhute | 0:30537dec6e0b | 170 | } |
akashvibhute | 0:30537dec6e0b | 171 | #endif |