hairo
Dependencies: mbed BufferedSerial
gazebo_msgs/SpawnModel.h@4:bcdd99711326, 2018-12-04 (annotated)
- Committer:
- tknara
- Date:
- Tue Dec 04 00:14:32 2018 +0000
- Revision:
- 4:bcdd99711326
- Parent:
- 0:9e9b7db60fd5
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_SERVICE_SpawnModel_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_SERVICE_SpawnModel_h |
garyservin | 0:9e9b7db60fd5 | 3 | #include <stdint.h> |
garyservin | 0:9e9b7db60fd5 | 4 | #include <string.h> |
garyservin | 0:9e9b7db60fd5 | 5 | #include <stdlib.h> |
garyservin | 0:9e9b7db60fd5 | 6 | #include "ros/msg.h" |
garyservin | 0:9e9b7db60fd5 | 7 | #include "geometry_msgs/Pose.h" |
garyservin | 0:9e9b7db60fd5 | 8 | |
garyservin | 0:9e9b7db60fd5 | 9 | namespace gazebo_msgs |
garyservin | 0:9e9b7db60fd5 | 10 | { |
garyservin | 0:9e9b7db60fd5 | 11 | |
garyservin | 0:9e9b7db60fd5 | 12 | static const char SPAWNMODEL[] = "gazebo_msgs/SpawnModel"; |
garyservin | 0:9e9b7db60fd5 | 13 | |
garyservin | 0:9e9b7db60fd5 | 14 | class SpawnModelRequest : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 15 | { |
garyservin | 0:9e9b7db60fd5 | 16 | public: |
garyservin | 0:9e9b7db60fd5 | 17 | typedef const char* _model_name_type; |
garyservin | 0:9e9b7db60fd5 | 18 | _model_name_type model_name; |
garyservin | 0:9e9b7db60fd5 | 19 | typedef const char* _model_xml_type; |
garyservin | 0:9e9b7db60fd5 | 20 | _model_xml_type model_xml; |
garyservin | 0:9e9b7db60fd5 | 21 | typedef const char* _robot_namespace_type; |
garyservin | 0:9e9b7db60fd5 | 22 | _robot_namespace_type robot_namespace; |
garyservin | 0:9e9b7db60fd5 | 23 | typedef geometry_msgs::Pose _initial_pose_type; |
garyservin | 0:9e9b7db60fd5 | 24 | _initial_pose_type initial_pose; |
garyservin | 0:9e9b7db60fd5 | 25 | typedef const char* _reference_frame_type; |
garyservin | 0:9e9b7db60fd5 | 26 | _reference_frame_type reference_frame; |
garyservin | 0:9e9b7db60fd5 | 27 | |
garyservin | 0:9e9b7db60fd5 | 28 | SpawnModelRequest(): |
garyservin | 0:9e9b7db60fd5 | 29 | model_name(""), |
garyservin | 0:9e9b7db60fd5 | 30 | model_xml(""), |
garyservin | 0:9e9b7db60fd5 | 31 | robot_namespace(""), |
garyservin | 0:9e9b7db60fd5 | 32 | initial_pose(), |
garyservin | 0:9e9b7db60fd5 | 33 | reference_frame("") |
garyservin | 0:9e9b7db60fd5 | 34 | { |
garyservin | 0:9e9b7db60fd5 | 35 | } |
garyservin | 0:9e9b7db60fd5 | 36 | |
garyservin | 0:9e9b7db60fd5 | 37 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 38 | { |
garyservin | 0:9e9b7db60fd5 | 39 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 40 | uint32_t length_model_name = strlen(this->model_name); |
garyservin | 0:9e9b7db60fd5 | 41 | varToArr(outbuffer + offset, length_model_name); |
garyservin | 0:9e9b7db60fd5 | 42 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 43 | memcpy(outbuffer + offset, this->model_name, length_model_name); |
garyservin | 0:9e9b7db60fd5 | 44 | offset += length_model_name; |
garyservin | 0:9e9b7db60fd5 | 45 | uint32_t length_model_xml = strlen(this->model_xml); |
garyservin | 0:9e9b7db60fd5 | 46 | varToArr(outbuffer + offset, length_model_xml); |
garyservin | 0:9e9b7db60fd5 | 47 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 48 | memcpy(outbuffer + offset, this->model_xml, length_model_xml); |
garyservin | 0:9e9b7db60fd5 | 49 | offset += length_model_xml; |
garyservin | 0:9e9b7db60fd5 | 50 | uint32_t length_robot_namespace = strlen(this->robot_namespace); |
garyservin | 0:9e9b7db60fd5 | 51 | varToArr(outbuffer + offset, length_robot_namespace); |
garyservin | 0:9e9b7db60fd5 | 52 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 53 | memcpy(outbuffer + offset, this->robot_namespace, length_robot_namespace); |
garyservin | 0:9e9b7db60fd5 | 54 | offset += length_robot_namespace; |
garyservin | 0:9e9b7db60fd5 | 55 | offset += this->initial_pose.serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 56 | uint32_t length_reference_frame = strlen(this->reference_frame); |
garyservin | 0:9e9b7db60fd5 | 57 | varToArr(outbuffer + offset, length_reference_frame); |
garyservin | 0:9e9b7db60fd5 | 58 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 59 | memcpy(outbuffer + offset, this->reference_frame, length_reference_frame); |
garyservin | 0:9e9b7db60fd5 | 60 | offset += length_reference_frame; |
garyservin | 0:9e9b7db60fd5 | 61 | return offset; |
garyservin | 0:9e9b7db60fd5 | 62 | } |
garyservin | 0:9e9b7db60fd5 | 63 | |
garyservin | 0:9e9b7db60fd5 | 64 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 65 | { |
garyservin | 0:9e9b7db60fd5 | 66 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 67 | uint32_t length_model_name; |
garyservin | 0:9e9b7db60fd5 | 68 | arrToVar(length_model_name, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 69 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 70 | for(unsigned int k= offset; k< offset+length_model_name; ++k){ |
garyservin | 0:9e9b7db60fd5 | 71 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 72 | } |
garyservin | 0:9e9b7db60fd5 | 73 | inbuffer[offset+length_model_name-1]=0; |
garyservin | 0:9e9b7db60fd5 | 74 | this->model_name = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 75 | offset += length_model_name; |
garyservin | 0:9e9b7db60fd5 | 76 | uint32_t length_model_xml; |
garyservin | 0:9e9b7db60fd5 | 77 | arrToVar(length_model_xml, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 78 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 79 | for(unsigned int k= offset; k< offset+length_model_xml; ++k){ |
garyservin | 0:9e9b7db60fd5 | 80 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 81 | } |
garyservin | 0:9e9b7db60fd5 | 82 | inbuffer[offset+length_model_xml-1]=0; |
garyservin | 0:9e9b7db60fd5 | 83 | this->model_xml = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 84 | offset += length_model_xml; |
garyservin | 0:9e9b7db60fd5 | 85 | uint32_t length_robot_namespace; |
garyservin | 0:9e9b7db60fd5 | 86 | arrToVar(length_robot_namespace, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 87 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 88 | for(unsigned int k= offset; k< offset+length_robot_namespace; ++k){ |
garyservin | 0:9e9b7db60fd5 | 89 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 90 | } |
garyservin | 0:9e9b7db60fd5 | 91 | inbuffer[offset+length_robot_namespace-1]=0; |
garyservin | 0:9e9b7db60fd5 | 92 | this->robot_namespace = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 93 | offset += length_robot_namespace; |
garyservin | 0:9e9b7db60fd5 | 94 | offset += this->initial_pose.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 95 | uint32_t length_reference_frame; |
garyservin | 0:9e9b7db60fd5 | 96 | arrToVar(length_reference_frame, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 97 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 98 | for(unsigned int k= offset; k< offset+length_reference_frame; ++k){ |
garyservin | 0:9e9b7db60fd5 | 99 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 100 | } |
garyservin | 0:9e9b7db60fd5 | 101 | inbuffer[offset+length_reference_frame-1]=0; |
garyservin | 0:9e9b7db60fd5 | 102 | this->reference_frame = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 103 | offset += length_reference_frame; |
garyservin | 0:9e9b7db60fd5 | 104 | return offset; |
garyservin | 0:9e9b7db60fd5 | 105 | } |
garyservin | 0:9e9b7db60fd5 | 106 | |
garyservin | 0:9e9b7db60fd5 | 107 | const char * getType(){ return SPAWNMODEL; }; |
garyservin | 0:9e9b7db60fd5 | 108 | const char * getMD5(){ return "6d0eba5753761cd57e6263a056b79930"; }; |
garyservin | 0:9e9b7db60fd5 | 109 | |
garyservin | 0:9e9b7db60fd5 | 110 | }; |
garyservin | 0:9e9b7db60fd5 | 111 | |
garyservin | 0:9e9b7db60fd5 | 112 | class SpawnModelResponse : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 113 | { |
garyservin | 0:9e9b7db60fd5 | 114 | public: |
garyservin | 0:9e9b7db60fd5 | 115 | typedef bool _success_type; |
garyservin | 0:9e9b7db60fd5 | 116 | _success_type success; |
garyservin | 0:9e9b7db60fd5 | 117 | typedef const char* _status_message_type; |
garyservin | 0:9e9b7db60fd5 | 118 | _status_message_type status_message; |
garyservin | 0:9e9b7db60fd5 | 119 | |
garyservin | 0:9e9b7db60fd5 | 120 | SpawnModelResponse(): |
garyservin | 0:9e9b7db60fd5 | 121 | success(0), |
garyservin | 0:9e9b7db60fd5 | 122 | status_message("") |
garyservin | 0:9e9b7db60fd5 | 123 | { |
garyservin | 0:9e9b7db60fd5 | 124 | } |
garyservin | 0:9e9b7db60fd5 | 125 | |
garyservin | 0:9e9b7db60fd5 | 126 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 127 | { |
garyservin | 0:9e9b7db60fd5 | 128 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 129 | union { |
garyservin | 0:9e9b7db60fd5 | 130 | bool real; |
garyservin | 0:9e9b7db60fd5 | 131 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 132 | } u_success; |
garyservin | 0:9e9b7db60fd5 | 133 | u_success.real = this->success; |
garyservin | 0:9e9b7db60fd5 | 134 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 135 | offset += sizeof(this->success); |
garyservin | 0:9e9b7db60fd5 | 136 | uint32_t length_status_message = strlen(this->status_message); |
garyservin | 0:9e9b7db60fd5 | 137 | varToArr(outbuffer + offset, length_status_message); |
garyservin | 0:9e9b7db60fd5 | 138 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 139 | memcpy(outbuffer + offset, this->status_message, length_status_message); |
garyservin | 0:9e9b7db60fd5 | 140 | offset += length_status_message; |
garyservin | 0:9e9b7db60fd5 | 141 | return offset; |
garyservin | 0:9e9b7db60fd5 | 142 | } |
garyservin | 0:9e9b7db60fd5 | 143 | |
garyservin | 0:9e9b7db60fd5 | 144 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 145 | { |
garyservin | 0:9e9b7db60fd5 | 146 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 147 | union { |
garyservin | 0:9e9b7db60fd5 | 148 | bool real; |
garyservin | 0:9e9b7db60fd5 | 149 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 150 | } u_success; |
garyservin | 0:9e9b7db60fd5 | 151 | u_success.base = 0; |
garyservin | 0:9e9b7db60fd5 | 152 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 153 | this->success = u_success.real; |
garyservin | 0:9e9b7db60fd5 | 154 | offset += sizeof(this->success); |
garyservin | 0:9e9b7db60fd5 | 155 | uint32_t length_status_message; |
garyservin | 0:9e9b7db60fd5 | 156 | arrToVar(length_status_message, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 157 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 158 | for(unsigned int k= offset; k< offset+length_status_message; ++k){ |
garyservin | 0:9e9b7db60fd5 | 159 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 160 | } |
garyservin | 0:9e9b7db60fd5 | 161 | inbuffer[offset+length_status_message-1]=0; |
garyservin | 0:9e9b7db60fd5 | 162 | this->status_message = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 163 | offset += length_status_message; |
garyservin | 0:9e9b7db60fd5 | 164 | return offset; |
garyservin | 0:9e9b7db60fd5 | 165 | } |
garyservin | 0:9e9b7db60fd5 | 166 | |
garyservin | 0:9e9b7db60fd5 | 167 | const char * getType(){ return SPAWNMODEL; }; |
garyservin | 0:9e9b7db60fd5 | 168 | const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; }; |
garyservin | 0:9e9b7db60fd5 | 169 | |
garyservin | 0:9e9b7db60fd5 | 170 | }; |
garyservin | 0:9e9b7db60fd5 | 171 | |
garyservin | 0:9e9b7db60fd5 | 172 | class SpawnModel { |
garyservin | 0:9e9b7db60fd5 | 173 | public: |
garyservin | 0:9e9b7db60fd5 | 174 | typedef SpawnModelRequest Request; |
garyservin | 0:9e9b7db60fd5 | 175 | typedef SpawnModelResponse Response; |
garyservin | 0:9e9b7db60fd5 | 176 | }; |
garyservin | 0:9e9b7db60fd5 | 177 | |
garyservin | 0:9e9b7db60fd5 | 178 | } |
garyservin | 0:9e9b7db60fd5 | 179 | #endif |