rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
actionlib/TestRequestGoal.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_actionlib_TestRequestGoal_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_actionlib_TestRequestGoal_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/duration.h" |
akashvibhute | 0:30537dec6e0b | 9 | |
akashvibhute | 0:30537dec6e0b | 10 | namespace actionlib |
akashvibhute | 0:30537dec6e0b | 11 | { |
akashvibhute | 0:30537dec6e0b | 12 | |
akashvibhute | 0:30537dec6e0b | 13 | class TestRequestGoal : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 14 | { |
akashvibhute | 0:30537dec6e0b | 15 | public: |
akashvibhute | 0:30537dec6e0b | 16 | int32_t terminate_status; |
akashvibhute | 0:30537dec6e0b | 17 | bool ignore_cancel; |
akashvibhute | 0:30537dec6e0b | 18 | const char* result_text; |
akashvibhute | 0:30537dec6e0b | 19 | int32_t the_result; |
akashvibhute | 0:30537dec6e0b | 20 | bool is_simple_client; |
akashvibhute | 0:30537dec6e0b | 21 | ros::Duration delay_accept; |
akashvibhute | 0:30537dec6e0b | 22 | ros::Duration delay_terminate; |
akashvibhute | 0:30537dec6e0b | 23 | ros::Duration pause_status; |
akashvibhute | 0:30537dec6e0b | 24 | enum { TERMINATE_SUCCESS = 0 }; |
akashvibhute | 0:30537dec6e0b | 25 | enum { TERMINATE_ABORTED = 1 }; |
akashvibhute | 0:30537dec6e0b | 26 | enum { TERMINATE_REJECTED = 2 }; |
akashvibhute | 0:30537dec6e0b | 27 | enum { TERMINATE_LOSE = 3 }; |
akashvibhute | 0:30537dec6e0b | 28 | enum { TERMINATE_DROP = 4 }; |
akashvibhute | 0:30537dec6e0b | 29 | enum { TERMINATE_EXCEPTION = 5 }; |
akashvibhute | 0:30537dec6e0b | 30 | |
akashvibhute | 0:30537dec6e0b | 31 | TestRequestGoal(): |
akashvibhute | 0:30537dec6e0b | 32 | terminate_status(0), |
akashvibhute | 0:30537dec6e0b | 33 | ignore_cancel(0), |
akashvibhute | 0:30537dec6e0b | 34 | result_text(""), |
akashvibhute | 0:30537dec6e0b | 35 | the_result(0), |
akashvibhute | 0:30537dec6e0b | 36 | is_simple_client(0), |
akashvibhute | 0:30537dec6e0b | 37 | delay_accept(), |
akashvibhute | 0:30537dec6e0b | 38 | delay_terminate(), |
akashvibhute | 0:30537dec6e0b | 39 | pause_status() |
akashvibhute | 0:30537dec6e0b | 40 | { |
akashvibhute | 0:30537dec6e0b | 41 | } |
akashvibhute | 0:30537dec6e0b | 42 | |
akashvibhute | 0:30537dec6e0b | 43 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 44 | { |
akashvibhute | 0:30537dec6e0b | 45 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 46 | union { |
akashvibhute | 0:30537dec6e0b | 47 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 48 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 49 | } u_terminate_status; |
akashvibhute | 0:30537dec6e0b | 50 | u_terminate_status.real = this->terminate_status; |
akashvibhute | 0:30537dec6e0b | 51 | *(outbuffer + offset + 0) = (u_terminate_status.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 52 | *(outbuffer + offset + 1) = (u_terminate_status.base >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 53 | *(outbuffer + offset + 2) = (u_terminate_status.base >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 54 | *(outbuffer + offset + 3) = (u_terminate_status.base >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 55 | offset += sizeof(this->terminate_status); |
akashvibhute | 0:30537dec6e0b | 56 | union { |
akashvibhute | 0:30537dec6e0b | 57 | bool real; |
akashvibhute | 0:30537dec6e0b | 58 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 59 | } u_ignore_cancel; |
akashvibhute | 0:30537dec6e0b | 60 | u_ignore_cancel.real = this->ignore_cancel; |
akashvibhute | 0:30537dec6e0b | 61 | *(outbuffer + offset + 0) = (u_ignore_cancel.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 62 | offset += sizeof(this->ignore_cancel); |
akashvibhute | 0:30537dec6e0b | 63 | uint32_t length_result_text = strlen(this->result_text); |
akashvibhute | 0:30537dec6e0b | 64 | memcpy(outbuffer + offset, &length_result_text, sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 65 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 66 | memcpy(outbuffer + offset, this->result_text, length_result_text); |
akashvibhute | 0:30537dec6e0b | 67 | offset += length_result_text; |
akashvibhute | 0:30537dec6e0b | 68 | union { |
akashvibhute | 0:30537dec6e0b | 69 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 70 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 71 | } u_the_result; |
akashvibhute | 0:30537dec6e0b | 72 | u_the_result.real = this->the_result; |
akashvibhute | 0:30537dec6e0b | 73 | *(outbuffer + offset + 0) = (u_the_result.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 74 | *(outbuffer + offset + 1) = (u_the_result.base >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 75 | *(outbuffer + offset + 2) = (u_the_result.base >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 76 | *(outbuffer + offset + 3) = (u_the_result.base >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 77 | offset += sizeof(this->the_result); |
akashvibhute | 0:30537dec6e0b | 78 | union { |
akashvibhute | 0:30537dec6e0b | 79 | bool real; |
akashvibhute | 0:30537dec6e0b | 80 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 81 | } u_is_simple_client; |
akashvibhute | 0:30537dec6e0b | 82 | u_is_simple_client.real = this->is_simple_client; |
akashvibhute | 0:30537dec6e0b | 83 | *(outbuffer + offset + 0) = (u_is_simple_client.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 84 | offset += sizeof(this->is_simple_client); |
akashvibhute | 0:30537dec6e0b | 85 | *(outbuffer + offset + 0) = (this->delay_accept.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 86 | *(outbuffer + offset + 1) = (this->delay_accept.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 87 | *(outbuffer + offset + 2) = (this->delay_accept.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 88 | *(outbuffer + offset + 3) = (this->delay_accept.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 89 | offset += sizeof(this->delay_accept.sec); |
akashvibhute | 0:30537dec6e0b | 90 | *(outbuffer + offset + 0) = (this->delay_accept.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 91 | *(outbuffer + offset + 1) = (this->delay_accept.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 92 | *(outbuffer + offset + 2) = (this->delay_accept.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 93 | *(outbuffer + offset + 3) = (this->delay_accept.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 94 | offset += sizeof(this->delay_accept.nsec); |
akashvibhute | 0:30537dec6e0b | 95 | *(outbuffer + offset + 0) = (this->delay_terminate.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 96 | *(outbuffer + offset + 1) = (this->delay_terminate.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 97 | *(outbuffer + offset + 2) = (this->delay_terminate.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 98 | *(outbuffer + offset + 3) = (this->delay_terminate.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 99 | offset += sizeof(this->delay_terminate.sec); |
akashvibhute | 0:30537dec6e0b | 100 | *(outbuffer + offset + 0) = (this->delay_terminate.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 101 | *(outbuffer + offset + 1) = (this->delay_terminate.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 102 | *(outbuffer + offset + 2) = (this->delay_terminate.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 103 | *(outbuffer + offset + 3) = (this->delay_terminate.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 104 | offset += sizeof(this->delay_terminate.nsec); |
akashvibhute | 0:30537dec6e0b | 105 | *(outbuffer + offset + 0) = (this->pause_status.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 106 | *(outbuffer + offset + 1) = (this->pause_status.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 107 | *(outbuffer + offset + 2) = (this->pause_status.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 108 | *(outbuffer + offset + 3) = (this->pause_status.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 109 | offset += sizeof(this->pause_status.sec); |
akashvibhute | 0:30537dec6e0b | 110 | *(outbuffer + offset + 0) = (this->pause_status.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 111 | *(outbuffer + offset + 1) = (this->pause_status.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 112 | *(outbuffer + offset + 2) = (this->pause_status.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 113 | *(outbuffer + offset + 3) = (this->pause_status.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 114 | offset += sizeof(this->pause_status.nsec); |
akashvibhute | 0:30537dec6e0b | 115 | return offset; |
akashvibhute | 0:30537dec6e0b | 116 | } |
akashvibhute | 0:30537dec6e0b | 117 | |
akashvibhute | 0:30537dec6e0b | 118 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 119 | { |
akashvibhute | 0:30537dec6e0b | 120 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 121 | union { |
akashvibhute | 0:30537dec6e0b | 122 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 123 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 124 | } u_terminate_status; |
akashvibhute | 0:30537dec6e0b | 125 | u_terminate_status.base = 0; |
akashvibhute | 0:30537dec6e0b | 126 | u_terminate_status.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 127 | u_terminate_status.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 128 | u_terminate_status.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 129 | u_terminate_status.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 130 | this->terminate_status = u_terminate_status.real; |
akashvibhute | 0:30537dec6e0b | 131 | offset += sizeof(this->terminate_status); |
akashvibhute | 0:30537dec6e0b | 132 | union { |
akashvibhute | 0:30537dec6e0b | 133 | bool real; |
akashvibhute | 0:30537dec6e0b | 134 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 135 | } u_ignore_cancel; |
akashvibhute | 0:30537dec6e0b | 136 | u_ignore_cancel.base = 0; |
akashvibhute | 0:30537dec6e0b | 137 | u_ignore_cancel.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 138 | this->ignore_cancel = u_ignore_cancel.real; |
akashvibhute | 0:30537dec6e0b | 139 | offset += sizeof(this->ignore_cancel); |
akashvibhute | 0:30537dec6e0b | 140 | uint32_t length_result_text; |
akashvibhute | 0:30537dec6e0b | 141 | memcpy(&length_result_text, (inbuffer + offset), sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 142 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 143 | for(unsigned int k= offset; k< offset+length_result_text; ++k){ |
akashvibhute | 0:30537dec6e0b | 144 | inbuffer[k-1]=inbuffer[k]; |
akashvibhute | 0:30537dec6e0b | 145 | } |
akashvibhute | 0:30537dec6e0b | 146 | inbuffer[offset+length_result_text-1]=0; |
akashvibhute | 0:30537dec6e0b | 147 | this->result_text = (char *)(inbuffer + offset-1); |
akashvibhute | 0:30537dec6e0b | 148 | offset += length_result_text; |
akashvibhute | 0:30537dec6e0b | 149 | union { |
akashvibhute | 0:30537dec6e0b | 150 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 151 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 152 | } u_the_result; |
akashvibhute | 0:30537dec6e0b | 153 | u_the_result.base = 0; |
akashvibhute | 0:30537dec6e0b | 154 | u_the_result.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 155 | u_the_result.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 156 | u_the_result.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 157 | u_the_result.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 158 | this->the_result = u_the_result.real; |
akashvibhute | 0:30537dec6e0b | 159 | offset += sizeof(this->the_result); |
akashvibhute | 0:30537dec6e0b | 160 | union { |
akashvibhute | 0:30537dec6e0b | 161 | bool real; |
akashvibhute | 0:30537dec6e0b | 162 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 163 | } u_is_simple_client; |
akashvibhute | 0:30537dec6e0b | 164 | u_is_simple_client.base = 0; |
akashvibhute | 0:30537dec6e0b | 165 | u_is_simple_client.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 166 | this->is_simple_client = u_is_simple_client.real; |
akashvibhute | 0:30537dec6e0b | 167 | offset += sizeof(this->is_simple_client); |
akashvibhute | 0:30537dec6e0b | 168 | this->delay_accept.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 169 | this->delay_accept.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 170 | this->delay_accept.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 171 | this->delay_accept.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 172 | offset += sizeof(this->delay_accept.sec); |
akashvibhute | 0:30537dec6e0b | 173 | this->delay_accept.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 174 | this->delay_accept.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 175 | this->delay_accept.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 176 | this->delay_accept.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 177 | offset += sizeof(this->delay_accept.nsec); |
akashvibhute | 0:30537dec6e0b | 178 | this->delay_terminate.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 179 | this->delay_terminate.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 180 | this->delay_terminate.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 181 | this->delay_terminate.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 182 | offset += sizeof(this->delay_terminate.sec); |
akashvibhute | 0:30537dec6e0b | 183 | this->delay_terminate.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 184 | this->delay_terminate.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 185 | this->delay_terminate.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 186 | this->delay_terminate.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 187 | offset += sizeof(this->delay_terminate.nsec); |
akashvibhute | 0:30537dec6e0b | 188 | this->pause_status.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 189 | this->pause_status.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 190 | this->pause_status.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 191 | this->pause_status.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 192 | offset += sizeof(this->pause_status.sec); |
akashvibhute | 0:30537dec6e0b | 193 | this->pause_status.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 194 | this->pause_status.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 195 | this->pause_status.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 196 | this->pause_status.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 197 | offset += sizeof(this->pause_status.nsec); |
akashvibhute | 0:30537dec6e0b | 198 | return offset; |
akashvibhute | 0:30537dec6e0b | 199 | } |
akashvibhute | 0:30537dec6e0b | 200 | |
akashvibhute | 0:30537dec6e0b | 201 | const char * getType(){ return "actionlib/TestRequestGoal"; }; |
akashvibhute | 0:30537dec6e0b | 202 | const char * getMD5(){ return "db5d00ba98302d6c6dd3737e9a03ceea"; }; |
akashvibhute | 0:30537dec6e0b | 203 | |
akashvibhute | 0:30537dec6e0b | 204 | }; |
akashvibhute | 0:30537dec6e0b | 205 | |
akashvibhute | 0:30537dec6e0b | 206 | } |
akashvibhute | 0:30537dec6e0b | 207 | #endif |