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