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.
GetJointProperties.h
00001 #ifndef _ROS_SERVICE_GetJointProperties_h 00002 #define _ROS_SERVICE_GetJointProperties_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 GETJOINTPROPERTIES[] = "gazebo_msgs/GetJointProperties"; 00012 00013 class GetJointPropertiesRequest : public ros::Msg 00014 { 00015 public: 00016 typedef const char* _joint_name_type; 00017 _joint_name_type joint_name; 00018 00019 GetJointPropertiesRequest(): 00020 joint_name("") 00021 { 00022 } 00023 00024 virtual int serialize(unsigned char *outbuffer) const 00025 { 00026 int offset = 0; 00027 uint32_t length_joint_name = strlen(this->joint_name); 00028 varToArr(outbuffer + offset, length_joint_name); 00029 offset += 4; 00030 memcpy(outbuffer + offset, this->joint_name, length_joint_name); 00031 offset += length_joint_name; 00032 return offset; 00033 } 00034 00035 virtual int deserialize(unsigned char *inbuffer) 00036 { 00037 int offset = 0; 00038 uint32_t length_joint_name; 00039 arrToVar(length_joint_name, (inbuffer + offset)); 00040 offset += 4; 00041 for(unsigned int k= offset; k< offset+length_joint_name; ++k){ 00042 inbuffer[k-1]=inbuffer[k]; 00043 } 00044 inbuffer[offset+length_joint_name-1]=0; 00045 this->joint_name = (char *)(inbuffer + offset-1); 00046 offset += length_joint_name; 00047 return offset; 00048 } 00049 00050 const char * getType(){ return GETJOINTPROPERTIES; }; 00051 const char * getMD5(){ return "0be1351618e1dc030eb7959d9a4902de"; }; 00052 00053 }; 00054 00055 class GetJointPropertiesResponse : public ros::Msg 00056 { 00057 public: 00058 typedef uint8_t _type_type; 00059 _type_type type; 00060 uint32_t damping_length; 00061 typedef double _damping_type; 00062 _damping_type st_damping; 00063 _damping_type * damping; 00064 uint32_t position_length; 00065 typedef double _position_type; 00066 _position_type st_position; 00067 _position_type * position; 00068 uint32_t rate_length; 00069 typedef double _rate_type; 00070 _rate_type st_rate; 00071 _rate_type * rate; 00072 typedef bool _success_type; 00073 _success_type success; 00074 typedef const char* _status_message_type; 00075 _status_message_type status_message; 00076 enum { REVOLUTE = 0 }; 00077 enum { CONTINUOUS = 1 }; 00078 enum { PRISMATIC = 2 }; 00079 enum { FIXED = 3 }; 00080 enum { BALL = 4 }; 00081 enum { UNIVERSAL = 5 }; 00082 00083 GetJointPropertiesResponse(): 00084 type(0), 00085 damping_length(0), damping(NULL), 00086 position_length(0), position(NULL), 00087 rate_length(0), rate(NULL), 00088 success(0), 00089 status_message("") 00090 { 00091 } 00092 00093 virtual int serialize(unsigned char *outbuffer) const 00094 { 00095 int offset = 0; 00096 *(outbuffer + offset + 0) = (this->type >> (8 * 0)) & 0xFF; 00097 offset += sizeof(this->type); 00098 *(outbuffer + offset + 0) = (this->damping_length >> (8 * 0)) & 0xFF; 00099 *(outbuffer + offset + 1) = (this->damping_length >> (8 * 1)) & 0xFF; 00100 *(outbuffer + offset + 2) = (this->damping_length >> (8 * 2)) & 0xFF; 00101 *(outbuffer + offset + 3) = (this->damping_length >> (8 * 3)) & 0xFF; 00102 offset += sizeof(this->damping_length); 00103 for( uint32_t i = 0; i < damping_length; i++){ 00104 union { 00105 double real; 00106 uint64_t base; 00107 } u_dampingi; 00108 u_dampingi.real = this->damping[i]; 00109 *(outbuffer + offset + 0) = (u_dampingi.base >> (8 * 0)) & 0xFF; 00110 *(outbuffer + offset + 1) = (u_dampingi.base >> (8 * 1)) & 0xFF; 00111 *(outbuffer + offset + 2) = (u_dampingi.base >> (8 * 2)) & 0xFF; 00112 *(outbuffer + offset + 3) = (u_dampingi.base >> (8 * 3)) & 0xFF; 00113 *(outbuffer + offset + 4) = (u_dampingi.base >> (8 * 4)) & 0xFF; 00114 *(outbuffer + offset + 5) = (u_dampingi.base >> (8 * 5)) & 0xFF; 00115 *(outbuffer + offset + 6) = (u_dampingi.base >> (8 * 6)) & 0xFF; 00116 *(outbuffer + offset + 7) = (u_dampingi.base >> (8 * 7)) & 0xFF; 00117 offset += sizeof(this->damping[i]); 00118 } 00119 *(outbuffer + offset + 0) = (this->position_length >> (8 * 0)) & 0xFF; 00120 *(outbuffer + offset + 1) = (this->position_length >> (8 * 1)) & 0xFF; 00121 *(outbuffer + offset + 2) = (this->position_length >> (8 * 2)) & 0xFF; 00122 *(outbuffer + offset + 3) = (this->position_length >> (8 * 3)) & 0xFF; 00123 offset += sizeof(this->position_length); 00124 for( uint32_t i = 0; i < position_length; i++){ 00125 union { 00126 double real; 00127 uint64_t base; 00128 } u_positioni; 00129 u_positioni.real = this->position[i]; 00130 *(outbuffer + offset + 0) = (u_positioni.base >> (8 * 0)) & 0xFF; 00131 *(outbuffer + offset + 1) = (u_positioni.base >> (8 * 1)) & 0xFF; 00132 *(outbuffer + offset + 2) = (u_positioni.base >> (8 * 2)) & 0xFF; 00133 *(outbuffer + offset + 3) = (u_positioni.base >> (8 * 3)) & 0xFF; 00134 *(outbuffer + offset + 4) = (u_positioni.base >> (8 * 4)) & 0xFF; 00135 *(outbuffer + offset + 5) = (u_positioni.base >> (8 * 5)) & 0xFF; 00136 *(outbuffer + offset + 6) = (u_positioni.base >> (8 * 6)) & 0xFF; 00137 *(outbuffer + offset + 7) = (u_positioni.base >> (8 * 7)) & 0xFF; 00138 offset += sizeof(this->position[i]); 00139 } 00140 *(outbuffer + offset + 0) = (this->rate_length >> (8 * 0)) & 0xFF; 00141 *(outbuffer + offset + 1) = (this->rate_length >> (8 * 1)) & 0xFF; 00142 *(outbuffer + offset + 2) = (this->rate_length >> (8 * 2)) & 0xFF; 00143 *(outbuffer + offset + 3) = (this->rate_length >> (8 * 3)) & 0xFF; 00144 offset += sizeof(this->rate_length); 00145 for( uint32_t i = 0; i < rate_length; i++){ 00146 union { 00147 double real; 00148 uint64_t base; 00149 } u_ratei; 00150 u_ratei.real = this->rate[i]; 00151 *(outbuffer + offset + 0) = (u_ratei.base >> (8 * 0)) & 0xFF; 00152 *(outbuffer + offset + 1) = (u_ratei.base >> (8 * 1)) & 0xFF; 00153 *(outbuffer + offset + 2) = (u_ratei.base >> (8 * 2)) & 0xFF; 00154 *(outbuffer + offset + 3) = (u_ratei.base >> (8 * 3)) & 0xFF; 00155 *(outbuffer + offset + 4) = (u_ratei.base >> (8 * 4)) & 0xFF; 00156 *(outbuffer + offset + 5) = (u_ratei.base >> (8 * 5)) & 0xFF; 00157 *(outbuffer + offset + 6) = (u_ratei.base >> (8 * 6)) & 0xFF; 00158 *(outbuffer + offset + 7) = (u_ratei.base >> (8 * 7)) & 0xFF; 00159 offset += sizeof(this->rate[i]); 00160 } 00161 union { 00162 bool real; 00163 uint8_t base; 00164 } u_success; 00165 u_success.real = this->success; 00166 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; 00167 offset += sizeof(this->success); 00168 uint32_t length_status_message = strlen(this->status_message); 00169 varToArr(outbuffer + offset, length_status_message); 00170 offset += 4; 00171 memcpy(outbuffer + offset, this->status_message, length_status_message); 00172 offset += length_status_message; 00173 return offset; 00174 } 00175 00176 virtual int deserialize(unsigned char *inbuffer) 00177 { 00178 int offset = 0; 00179 this->type = ((uint8_t) (*(inbuffer + offset))); 00180 offset += sizeof(this->type); 00181 uint32_t damping_lengthT = ((uint32_t) (*(inbuffer + offset))); 00182 damping_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00183 damping_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00184 damping_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00185 offset += sizeof(this->damping_length); 00186 if(damping_lengthT > damping_length) 00187 this->damping = (double*)realloc(this->damping, damping_lengthT * sizeof(double)); 00188 damping_length = damping_lengthT; 00189 for( uint32_t i = 0; i < damping_length; i++){ 00190 union { 00191 double real; 00192 uint64_t base; 00193 } u_st_damping; 00194 u_st_damping.base = 0; 00195 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00196 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00197 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00198 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00199 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00200 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00201 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00202 u_st_damping.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00203 this->st_damping = u_st_damping.real; 00204 offset += sizeof(this->st_damping); 00205 memcpy( &(this->damping[i]), &(this->st_damping), sizeof(double)); 00206 } 00207 uint32_t position_lengthT = ((uint32_t) (*(inbuffer + offset))); 00208 position_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00209 position_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00210 position_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00211 offset += sizeof(this->position_length); 00212 if(position_lengthT > position_length) 00213 this->position = (double*)realloc(this->position, position_lengthT * sizeof(double)); 00214 position_length = position_lengthT; 00215 for( uint32_t i = 0; i < position_length; i++){ 00216 union { 00217 double real; 00218 uint64_t base; 00219 } u_st_position; 00220 u_st_position.base = 0; 00221 u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00222 u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00223 u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00224 u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00225 u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00226 u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00227 u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00228 u_st_position.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00229 this->st_position = u_st_position.real; 00230 offset += sizeof(this->st_position); 00231 memcpy( &(this->position[i]), &(this->st_position), sizeof(double)); 00232 } 00233 uint32_t rate_lengthT = ((uint32_t) (*(inbuffer + offset))); 00234 rate_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00235 rate_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00236 rate_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00237 offset += sizeof(this->rate_length); 00238 if(rate_lengthT > rate_length) 00239 this->rate = (double*)realloc(this->rate, rate_lengthT * sizeof(double)); 00240 rate_length = rate_lengthT; 00241 for( uint32_t i = 0; i < rate_length; i++){ 00242 union { 00243 double real; 00244 uint64_t base; 00245 } u_st_rate; 00246 u_st_rate.base = 0; 00247 u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00248 u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00249 u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00250 u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00251 u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00252 u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00253 u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00254 u_st_rate.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00255 this->st_rate = u_st_rate.real; 00256 offset += sizeof(this->st_rate); 00257 memcpy( &(this->rate[i]), &(this->st_rate), sizeof(double)); 00258 } 00259 union { 00260 bool real; 00261 uint8_t base; 00262 } u_success; 00263 u_success.base = 0; 00264 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00265 this->success = u_success.real; 00266 offset += sizeof(this->success); 00267 uint32_t length_status_message; 00268 arrToVar(length_status_message, (inbuffer + offset)); 00269 offset += 4; 00270 for(unsigned int k= offset; k< offset+length_status_message; ++k){ 00271 inbuffer[k-1]=inbuffer[k]; 00272 } 00273 inbuffer[offset+length_status_message-1]=0; 00274 this->status_message = (char *)(inbuffer + offset-1); 00275 offset += length_status_message; 00276 return offset; 00277 } 00278 00279 const char * getType(){ return GETJOINTPROPERTIES; }; 00280 const char * getMD5(){ return "cd7b30a39faa372283dc94c5f6457f82"; }; 00281 00282 }; 00283 00284 class GetJointProperties { 00285 public: 00286 typedef GetJointPropertiesRequest Request; 00287 typedef GetJointPropertiesResponse Response; 00288 }; 00289 00290 } 00291 #endif
Generated on Wed Jul 13 2022 23:30:17 by
