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.
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
GetWorldProperties.h
00001 #ifndef _ROS_SERVICE_GetWorldProperties_h 00002 #define _ROS_SERVICE_GetWorldProperties_h 00003 #include <stdint.h> 00004 #include <string.h> 00005 #include <stdlib.h> 00006 #include "ros/msg.h" 00007 00008 namespace gazebo_msgs 00009 { 00010 00011 static const char GETWORLDPROPERTIES[] = "gazebo_msgs/GetWorldProperties"; 00012 00013 class GetWorldPropertiesRequest : public ros::Msg 00014 { 00015 public: 00016 00017 GetWorldPropertiesRequest() 00018 { 00019 } 00020 00021 virtual int serialize(unsigned char *outbuffer) const 00022 { 00023 int offset = 0; 00024 return offset; 00025 } 00026 00027 virtual int deserialize(unsigned char *inbuffer) 00028 { 00029 int offset = 0; 00030 return offset; 00031 } 00032 00033 const char * getType(){ return GETWORLDPROPERTIES; }; 00034 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; 00035 00036 }; 00037 00038 class GetWorldPropertiesResponse : public ros::Msg 00039 { 00040 public: 00041 double sim_time; 00042 uint8_t model_names_length; 00043 char* st_model_names; 00044 char* * model_names; 00045 bool rendering_enabled; 00046 bool success; 00047 const char* status_message; 00048 00049 GetWorldPropertiesResponse(): 00050 sim_time(0), 00051 model_names_length(0), model_names(NULL), 00052 rendering_enabled(0), 00053 success(0), 00054 status_message("") 00055 { 00056 } 00057 00058 virtual int serialize(unsigned char *outbuffer) const 00059 { 00060 int offset = 0; 00061 union { 00062 double real; 00063 uint64_t base; 00064 } u_sim_time; 00065 u_sim_time.real = this->sim_time; 00066 *(outbuffer + offset + 0) = (u_sim_time.base >> (8 * 0)) & 0xFF; 00067 *(outbuffer + offset + 1) = (u_sim_time.base >> (8 * 1)) & 0xFF; 00068 *(outbuffer + offset + 2) = (u_sim_time.base >> (8 * 2)) & 0xFF; 00069 *(outbuffer + offset + 3) = (u_sim_time.base >> (8 * 3)) & 0xFF; 00070 *(outbuffer + offset + 4) = (u_sim_time.base >> (8 * 4)) & 0xFF; 00071 *(outbuffer + offset + 5) = (u_sim_time.base >> (8 * 5)) & 0xFF; 00072 *(outbuffer + offset + 6) = (u_sim_time.base >> (8 * 6)) & 0xFF; 00073 *(outbuffer + offset + 7) = (u_sim_time.base >> (8 * 7)) & 0xFF; 00074 offset += sizeof(this->sim_time); 00075 *(outbuffer + offset++) = model_names_length; 00076 *(outbuffer + offset++) = 0; 00077 *(outbuffer + offset++) = 0; 00078 *(outbuffer + offset++) = 0; 00079 for( uint8_t i = 0; i < model_names_length; i++){ 00080 uint32_t length_model_namesi = strlen(this->model_names[i]); 00081 memcpy(outbuffer + offset, &length_model_namesi, sizeof(uint32_t)); 00082 offset += 4; 00083 memcpy(outbuffer + offset, this->model_names[i], length_model_namesi); 00084 offset += length_model_namesi; 00085 } 00086 union { 00087 bool real; 00088 uint8_t base; 00089 } u_rendering_enabled; 00090 u_rendering_enabled.real = this->rendering_enabled; 00091 *(outbuffer + offset + 0) = (u_rendering_enabled.base >> (8 * 0)) & 0xFF; 00092 offset += sizeof(this->rendering_enabled); 00093 union { 00094 bool real; 00095 uint8_t base; 00096 } u_success; 00097 u_success.real = this->success; 00098 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; 00099 offset += sizeof(this->success); 00100 uint32_t length_status_message = strlen(this->status_message); 00101 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t)); 00102 offset += 4; 00103 memcpy(outbuffer + offset, this->status_message, length_status_message); 00104 offset += length_status_message; 00105 return offset; 00106 } 00107 00108 virtual int deserialize(unsigned char *inbuffer) 00109 { 00110 int offset = 0; 00111 union { 00112 double real; 00113 uint64_t base; 00114 } u_sim_time; 00115 u_sim_time.base = 0; 00116 u_sim_time.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00117 u_sim_time.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00118 u_sim_time.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00119 u_sim_time.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00120 u_sim_time.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00121 u_sim_time.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00122 u_sim_time.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00123 u_sim_time.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00124 this->sim_time = u_sim_time.real; 00125 offset += sizeof(this->sim_time); 00126 uint8_t model_names_lengthT = *(inbuffer + offset++); 00127 if(model_names_lengthT > model_names_length) 00128 this->model_names = (char**)realloc(this->model_names, model_names_lengthT * sizeof(char*)); 00129 offset += 3; 00130 model_names_length = model_names_lengthT; 00131 for( uint8_t i = 0; i < model_names_length; i++){ 00132 uint32_t length_st_model_names; 00133 memcpy(&length_st_model_names, (inbuffer + offset), sizeof(uint32_t)); 00134 offset += 4; 00135 for(unsigned int k= offset; k< offset+length_st_model_names; ++k){ 00136 inbuffer[k-1]=inbuffer[k]; 00137 } 00138 inbuffer[offset+length_st_model_names-1]=0; 00139 this->st_model_names = (char *)(inbuffer + offset-1); 00140 offset += length_st_model_names; 00141 memcpy( &(this->model_names[i]), &(this->st_model_names), sizeof(char*)); 00142 } 00143 union { 00144 bool real; 00145 uint8_t base; 00146 } u_rendering_enabled; 00147 u_rendering_enabled.base = 0; 00148 u_rendering_enabled.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00149 this->rendering_enabled = u_rendering_enabled.real; 00150 offset += sizeof(this->rendering_enabled); 00151 union { 00152 bool real; 00153 uint8_t base; 00154 } u_success; 00155 u_success.base = 0; 00156 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00157 this->success = u_success.real; 00158 offset += sizeof(this->success); 00159 uint32_t length_status_message; 00160 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t)); 00161 offset += 4; 00162 for(unsigned int k= offset; k< offset+length_status_message; ++k){ 00163 inbuffer[k-1]=inbuffer[k]; 00164 } 00165 inbuffer[offset+length_status_message-1]=0; 00166 this->status_message = (char *)(inbuffer + offset-1); 00167 offset += length_status_message; 00168 return offset; 00169 } 00170 00171 const char * getType(){ return GETWORLDPROPERTIES; }; 00172 const char * getMD5(){ return "36bb0f2eccf4d8be971410c22818ba3f"; }; 00173 00174 }; 00175 00176 class GetWorldProperties { 00177 public: 00178 typedef GetWorldPropertiesRequest Request; 00179 typedef GetWorldPropertiesResponse Response; 00180 }; 00181 00182 } 00183 #endif
Generated on Tue Jul 12 2022 18:39:39 by
1.7.2