Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_GetPhysicsProperties_h
00002 #define _ROS_SERVICE_GetPhysicsProperties_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "geometry_msgs/Vector3.h"
00008 #include "gazebo_msgs/ODEPhysics.h"
00009
00010 namespace gazebo_msgs
00011 {
00012
00013 static const char GETPHYSICSPROPERTIES[] = "gazebo_msgs/GetPhysicsProperties";
00014
00015 class GetPhysicsPropertiesRequest : public ros::Msg
00016 {
00017 public:
00018
00019 virtual int serialize(unsigned char *outbuffer) const
00020 {
00021 int offset = 0;
00022 return offset;
00023 }
00024
00025 virtual int deserialize(unsigned char *inbuffer)
00026 {
00027 int offset = 0;
00028 return offset;
00029 }
00030
00031 const char * getType(){ return GETPHYSICSPROPERTIES; };
00032 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00033
00034 };
00035
00036 class GetPhysicsPropertiesResponse : public ros::Msg
00037 {
00038 public:
00039 float time_step;
00040 bool pause;
00041 float max_update_rate;
00042 geometry_msgs::Vector3 gravity;
00043 gazebo_msgs::ODEPhysics ode_config;
00044 bool success;
00045 char * status_message;
00046
00047 virtual int serialize(unsigned char *outbuffer) const
00048 {
00049 int offset = 0;
00050 int32_t * val_time_step = (int32_t *) &(this->time_step);
00051 int32_t exp_time_step = (((*val_time_step)>>23)&255);
00052 if(exp_time_step != 0)
00053 exp_time_step += 1023-127;
00054 int32_t sig_time_step = *val_time_step;
00055 *(outbuffer + offset++) = 0;
00056 *(outbuffer + offset++) = 0;
00057 *(outbuffer + offset++) = 0;
00058 *(outbuffer + offset++) = (sig_time_step<<5) & 0xff;
00059 *(outbuffer + offset++) = (sig_time_step>>3) & 0xff;
00060 *(outbuffer + offset++) = (sig_time_step>>11) & 0xff;
00061 *(outbuffer + offset++) = ((exp_time_step<<4) & 0xF0) | ((sig_time_step>>19)&0x0F);
00062 *(outbuffer + offset++) = (exp_time_step>>4) & 0x7F;
00063 if(this->time_step < 0) *(outbuffer + offset -1) |= 0x80;
00064 union {
00065 bool real;
00066 uint8_t base;
00067 } u_pause;
00068 u_pause.real = this->pause;
00069 *(outbuffer + offset + 0) = (u_pause.base >> (8 * 0)) & 0xFF;
00070 offset += sizeof(this->pause);
00071 int32_t * val_max_update_rate = (int32_t *) &(this->max_update_rate);
00072 int32_t exp_max_update_rate = (((*val_max_update_rate)>>23)&255);
00073 if(exp_max_update_rate != 0)
00074 exp_max_update_rate += 1023-127;
00075 int32_t sig_max_update_rate = *val_max_update_rate;
00076 *(outbuffer + offset++) = 0;
00077 *(outbuffer + offset++) = 0;
00078 *(outbuffer + offset++) = 0;
00079 *(outbuffer + offset++) = (sig_max_update_rate<<5) & 0xff;
00080 *(outbuffer + offset++) = (sig_max_update_rate>>3) & 0xff;
00081 *(outbuffer + offset++) = (sig_max_update_rate>>11) & 0xff;
00082 *(outbuffer + offset++) = ((exp_max_update_rate<<4) & 0xF0) | ((sig_max_update_rate>>19)&0x0F);
00083 *(outbuffer + offset++) = (exp_max_update_rate>>4) & 0x7F;
00084 if(this->max_update_rate < 0) *(outbuffer + offset -1) |= 0x80;
00085 offset += this->gravity.serialize(outbuffer + offset);
00086 offset += this->ode_config.serialize(outbuffer + offset);
00087 union {
00088 bool real;
00089 uint8_t base;
00090 } u_success;
00091 u_success.real = this->success;
00092 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00093 offset += sizeof(this->success);
00094 uint32_t length_status_message = strlen( (const char*) this->status_message);
00095 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
00096 offset += 4;
00097 memcpy(outbuffer + offset, this->status_message, length_status_message);
00098 offset += length_status_message;
00099 return offset;
00100 }
00101
00102 virtual int deserialize(unsigned char *inbuffer)
00103 {
00104 int offset = 0;
00105 uint32_t * val_time_step = (uint32_t*) &(this->time_step);
00106 offset += 3;
00107 *val_time_step = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00108 *val_time_step |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00109 *val_time_step |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00110 *val_time_step |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00111 uint32_t exp_time_step = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00112 exp_time_step |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00113 if(exp_time_step !=0)
00114 *val_time_step |= ((exp_time_step)-1023+127)<<23;
00115 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->time_step = -this->time_step;
00116 union {
00117 bool real;
00118 uint8_t base;
00119 } u_pause;
00120 u_pause.base = 0;
00121 u_pause.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00122 this->pause = u_pause.real;
00123 offset += sizeof(this->pause);
00124 uint32_t * val_max_update_rate = (uint32_t*) &(this->max_update_rate);
00125 offset += 3;
00126 *val_max_update_rate = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00127 *val_max_update_rate |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00128 *val_max_update_rate |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00129 *val_max_update_rate |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00130 uint32_t exp_max_update_rate = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00131 exp_max_update_rate |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00132 if(exp_max_update_rate !=0)
00133 *val_max_update_rate |= ((exp_max_update_rate)-1023+127)<<23;
00134 if( ((*(inbuffer+offset++)) & 0x80) > 0) this->max_update_rate = -this->max_update_rate;
00135 offset += this->gravity.deserialize(inbuffer + offset);
00136 offset += this->ode_config.deserialize(inbuffer + offset);
00137 union {
00138 bool real;
00139 uint8_t base;
00140 } u_success;
00141 u_success.base = 0;
00142 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00143 this->success = u_success.real;
00144 offset += sizeof(this->success);
00145 uint32_t length_status_message;
00146 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
00147 offset += 4;
00148 for(unsigned int k= offset; k< offset+length_status_message; ++k){
00149 inbuffer[k-1]=inbuffer[k];
00150 }
00151 inbuffer[offset+length_status_message-1]=0;
00152 this->status_message = (char *)(inbuffer + offset-1);
00153 offset += length_status_message;
00154 return offset;
00155 }
00156
00157 const char * getType(){ return GETPHYSICSPROPERTIES; };
00158 const char * getMD5(){ return "575a5e74786981b7df2e3afc567693a6"; };
00159
00160 };
00161
00162 class GetPhysicsProperties {
00163 public:
00164 typedef GetPhysicsPropertiesRequest Request;
00165 typedef GetPhysicsPropertiesResponse Response;
00166 };
00167
00168 }
00169 #endif