Gary Servin / ros_lib_jade

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher_jade

Committer:
garyservin
Date:
Thu Mar 31 23:23:15 2016 +0000
Revision:
0:a906bb7c7831
ROS Serial library for Mbed platforms for ROS Jade Turtle. Check http://wiki.ros.org/rosserial_mbed/ for more information.

Who changed what in which revision?

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