ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
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 const char* model_name; 00018 const char* model_xml; 00019 const char* robot_namespace; 00020 geometry_msgs::Pose initial_pose; 00021 const char* reference_frame; 00022 00023 SpawnModelRequest(): 00024 model_name(""), 00025 model_xml(""), 00026 robot_namespace(""), 00027 initial_pose(), 00028 reference_frame("") 00029 { 00030 } 00031 00032 virtual int serialize(unsigned char *outbuffer) const 00033 { 00034 int offset = 0; 00035 uint32_t length_model_name = strlen(this->model_name); 00036 memcpy(outbuffer + offset, &length_model_name, sizeof(uint32_t)); 00037 offset += 4; 00038 memcpy(outbuffer + offset, this->model_name, length_model_name); 00039 offset += length_model_name; 00040 uint32_t length_model_xml = strlen(this->model_xml); 00041 memcpy(outbuffer + offset, &length_model_xml, sizeof(uint32_t)); 00042 offset += 4; 00043 memcpy(outbuffer + offset, this->model_xml, length_model_xml); 00044 offset += length_model_xml; 00045 uint32_t length_robot_namespace = strlen(this->robot_namespace); 00046 memcpy(outbuffer + offset, &length_robot_namespace, sizeof(uint32_t)); 00047 offset += 4; 00048 memcpy(outbuffer + offset, this->robot_namespace, length_robot_namespace); 00049 offset += length_robot_namespace; 00050 offset += this->initial_pose.serialize(outbuffer + offset); 00051 uint32_t length_reference_frame = strlen(this->reference_frame); 00052 memcpy(outbuffer + offset, &length_reference_frame, sizeof(uint32_t)); 00053 offset += 4; 00054 memcpy(outbuffer + offset, this->reference_frame, length_reference_frame); 00055 offset += length_reference_frame; 00056 return offset; 00057 } 00058 00059 virtual int deserialize(unsigned char *inbuffer) 00060 { 00061 int offset = 0; 00062 uint32_t length_model_name; 00063 memcpy(&length_model_name, (inbuffer + offset), sizeof(uint32_t)); 00064 offset += 4; 00065 for(unsigned int k= offset; k< offset+length_model_name; ++k){ 00066 inbuffer[k-1]=inbuffer[k]; 00067 } 00068 inbuffer[offset+length_model_name-1]=0; 00069 this->model_name = (char *)(inbuffer + offset-1); 00070 offset += length_model_name; 00071 uint32_t length_model_xml; 00072 memcpy(&length_model_xml, (inbuffer + offset), sizeof(uint32_t)); 00073 offset += 4; 00074 for(unsigned int k= offset; k< offset+length_model_xml; ++k){ 00075 inbuffer[k-1]=inbuffer[k]; 00076 } 00077 inbuffer[offset+length_model_xml-1]=0; 00078 this->model_xml = (char *)(inbuffer + offset-1); 00079 offset += length_model_xml; 00080 uint32_t length_robot_namespace; 00081 memcpy(&length_robot_namespace, (inbuffer + offset), sizeof(uint32_t)); 00082 offset += 4; 00083 for(unsigned int k= offset; k< offset+length_robot_namespace; ++k){ 00084 inbuffer[k-1]=inbuffer[k]; 00085 } 00086 inbuffer[offset+length_robot_namespace-1]=0; 00087 this->robot_namespace = (char *)(inbuffer + offset-1); 00088 offset += length_robot_namespace; 00089 offset += this->initial_pose.deserialize(inbuffer + offset); 00090 uint32_t length_reference_frame; 00091 memcpy(&length_reference_frame, (inbuffer + offset), sizeof(uint32_t)); 00092 offset += 4; 00093 for(unsigned int k= offset; k< offset+length_reference_frame; ++k){ 00094 inbuffer[k-1]=inbuffer[k]; 00095 } 00096 inbuffer[offset+length_reference_frame-1]=0; 00097 this->reference_frame = (char *)(inbuffer + offset-1); 00098 offset += length_reference_frame; 00099 return offset; 00100 } 00101 00102 const char * getType(){ return SPAWNMODEL; }; 00103 const char * getMD5(){ return "6d0eba5753761cd57e6263a056b79930"; }; 00104 00105 }; 00106 00107 class SpawnModelResponse : public ros::Msg 00108 { 00109 public: 00110 bool success; 00111 const char* status_message; 00112 00113 SpawnModelResponse(): 00114 success(0), 00115 status_message("") 00116 { 00117 } 00118 00119 virtual int serialize(unsigned char *outbuffer) const 00120 { 00121 int offset = 0; 00122 union { 00123 bool real; 00124 uint8_t base; 00125 } u_success; 00126 u_success.real = this->success; 00127 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; 00128 offset += sizeof(this->success); 00129 uint32_t length_status_message = strlen(this->status_message); 00130 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t)); 00131 offset += 4; 00132 memcpy(outbuffer + offset, this->status_message, length_status_message); 00133 offset += length_status_message; 00134 return offset; 00135 } 00136 00137 virtual int deserialize(unsigned char *inbuffer) 00138 { 00139 int offset = 0; 00140 union { 00141 bool real; 00142 uint8_t base; 00143 } u_success; 00144 u_success.base = 0; 00145 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00146 this->success = u_success.real; 00147 offset += sizeof(this->success); 00148 uint32_t length_status_message; 00149 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t)); 00150 offset += 4; 00151 for(unsigned int k= offset; k< offset+length_status_message; ++k){ 00152 inbuffer[k-1]=inbuffer[k]; 00153 } 00154 inbuffer[offset+length_status_message-1]=0; 00155 this->status_message = (char *)(inbuffer + offset-1); 00156 offset += length_status_message; 00157 return offset; 00158 } 00159 00160 const char * getType(){ return SPAWNMODEL; }; 00161 const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; }; 00162 00163 }; 00164 00165 class SpawnModel { 00166 public: 00167 typedef SpawnModelRequest Request; 00168 typedef SpawnModelResponse Response; 00169 }; 00170 00171 } 00172 #endif
Generated on Tue Jul 12 2022 18:39:41 by 1.7.2