Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SpawnModel.h
00001 #ifndef _ROS_SERVICE_SpawnModel_h 00002 #define _ROS_SERVICE_SpawnModel_h 00003 #include <stdint.h> 00004 #include <string.h> 00005 #include <stdlib.h> 00006 #include "ros/msg.h" 00007 #include "geometry_msgs/Pose.h" 00008 00009 namespace gazebo_msgs 00010 { 00011 00012 static const char SPAWNMODEL[] = "gazebo_msgs/SpawnModel"; 00013 00014 class SpawnModelRequest : public ros::Msg 00015 { 00016 public: 00017 typedef const char* _model_name_type; 00018 _model_name_type model_name; 00019 typedef const char* _model_xml_type; 00020 _model_xml_type model_xml; 00021 typedef const char* _robot_namespace_type; 00022 _robot_namespace_type robot_namespace; 00023 typedef geometry_msgs::Pose _initial_pose_type; 00024 _initial_pose_type initial_pose; 00025 typedef const char* _reference_frame_type; 00026 _reference_frame_type reference_frame; 00027 00028 SpawnModelRequest(): 00029 model_name(""), 00030 model_xml(""), 00031 robot_namespace(""), 00032 initial_pose(), 00033 reference_frame("") 00034 { 00035 } 00036 00037 virtual int serialize(unsigned char *outbuffer) const 00038 { 00039 int offset = 0; 00040 uint32_t length_model_name = strlen(this->model_name); 00041 varToArr(outbuffer + offset, length_model_name); 00042 offset += 4; 00043 memcpy(outbuffer + offset, this->model_name, length_model_name); 00044 offset += length_model_name; 00045 uint32_t length_model_xml = strlen(this->model_xml); 00046 varToArr(outbuffer + offset, length_model_xml); 00047 offset += 4; 00048 memcpy(outbuffer + offset, this->model_xml, length_model_xml); 00049 offset += length_model_xml; 00050 uint32_t length_robot_namespace = strlen(this->robot_namespace); 00051 varToArr(outbuffer + offset, length_robot_namespace); 00052 offset += 4; 00053 memcpy(outbuffer + offset, this->robot_namespace, length_robot_namespace); 00054 offset += length_robot_namespace; 00055 offset += this->initial_pose.serialize(outbuffer + offset); 00056 uint32_t length_reference_frame = strlen(this->reference_frame); 00057 varToArr(outbuffer + offset, length_reference_frame); 00058 offset += 4; 00059 memcpy(outbuffer + offset, this->reference_frame, length_reference_frame); 00060 offset += length_reference_frame; 00061 return offset; 00062 } 00063 00064 virtual int deserialize(unsigned char *inbuffer) 00065 { 00066 int offset = 0; 00067 uint32_t length_model_name; 00068 arrToVar(length_model_name, (inbuffer + offset)); 00069 offset += 4; 00070 for(unsigned int k= offset; k< offset+length_model_name; ++k){ 00071 inbuffer[k-1]=inbuffer[k]; 00072 } 00073 inbuffer[offset+length_model_name-1]=0; 00074 this->model_name = (char *)(inbuffer + offset-1); 00075 offset += length_model_name; 00076 uint32_t length_model_xml; 00077 arrToVar(length_model_xml, (inbuffer + offset)); 00078 offset += 4; 00079 for(unsigned int k= offset; k< offset+length_model_xml; ++k){ 00080 inbuffer[k-1]=inbuffer[k]; 00081 } 00082 inbuffer[offset+length_model_xml-1]=0; 00083 this->model_xml = (char *)(inbuffer + offset-1); 00084 offset += length_model_xml; 00085 uint32_t length_robot_namespace; 00086 arrToVar(length_robot_namespace, (inbuffer + offset)); 00087 offset += 4; 00088 for(unsigned int k= offset; k< offset+length_robot_namespace; ++k){ 00089 inbuffer[k-1]=inbuffer[k]; 00090 } 00091 inbuffer[offset+length_robot_namespace-1]=0; 00092 this->robot_namespace = (char *)(inbuffer + offset-1); 00093 offset += length_robot_namespace; 00094 offset += this->initial_pose.deserialize(inbuffer + offset); 00095 uint32_t length_reference_frame; 00096 arrToVar(length_reference_frame, (inbuffer + offset)); 00097 offset += 4; 00098 for(unsigned int k= offset; k< offset+length_reference_frame; ++k){ 00099 inbuffer[k-1]=inbuffer[k]; 00100 } 00101 inbuffer[offset+length_reference_frame-1]=0; 00102 this->reference_frame = (char *)(inbuffer + offset-1); 00103 offset += length_reference_frame; 00104 return offset; 00105 } 00106 00107 const char * getType(){ return SPAWNMODEL; }; 00108 const char * getMD5(){ return "6d0eba5753761cd57e6263a056b79930"; }; 00109 00110 }; 00111 00112 class SpawnModelResponse : public ros::Msg 00113 { 00114 public: 00115 typedef bool _success_type; 00116 _success_type success; 00117 typedef const char* _status_message_type; 00118 _status_message_type status_message; 00119 00120 SpawnModelResponse(): 00121 success(0), 00122 status_message("") 00123 { 00124 } 00125 00126 virtual int serialize(unsigned char *outbuffer) const 00127 { 00128 int offset = 0; 00129 union { 00130 bool real; 00131 uint8_t base; 00132 } u_success; 00133 u_success.real = this->success; 00134 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; 00135 offset += sizeof(this->success); 00136 uint32_t length_status_message = strlen(this->status_message); 00137 varToArr(outbuffer + offset, length_status_message); 00138 offset += 4; 00139 memcpy(outbuffer + offset, this->status_message, length_status_message); 00140 offset += length_status_message; 00141 return offset; 00142 } 00143 00144 virtual int deserialize(unsigned char *inbuffer) 00145 { 00146 int offset = 0; 00147 union { 00148 bool real; 00149 uint8_t base; 00150 } u_success; 00151 u_success.base = 0; 00152 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00153 this->success = u_success.real; 00154 offset += sizeof(this->success); 00155 uint32_t length_status_message; 00156 arrToVar(length_status_message, (inbuffer + offset)); 00157 offset += 4; 00158 for(unsigned int k= offset; k< offset+length_status_message; ++k){ 00159 inbuffer[k-1]=inbuffer[k]; 00160 } 00161 inbuffer[offset+length_status_message-1]=0; 00162 this->status_message = (char *)(inbuffer + offset-1); 00163 offset += length_status_message; 00164 return offset; 00165 } 00166 00167 const char * getType(){ return SPAWNMODEL; }; 00168 const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; }; 00169 00170 }; 00171 00172 class SpawnModel { 00173 public: 00174 typedef SpawnModelRequest Request; 00175 typedef SpawnModelResponse Response; 00176 }; 00177 00178 } 00179 #endif
Generated on Wed Jul 13 2022 23:30:18 by
