Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GetPhysicsProperties.h Source File

GetPhysicsProperties.h

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     GetPhysicsPropertiesRequest()
00020     {
00021     }
00022 
00023     virtual int serialize(unsigned char *outbuffer) const
00024     {
00025       int offset = 0;
00026       return offset;
00027     }
00028 
00029     virtual int deserialize(unsigned char *inbuffer)
00030     {
00031       int offset = 0;
00032      return offset;
00033     }
00034 
00035     const char * getType(){ return GETPHYSICSPROPERTIES; };
00036     const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00037 
00038   };
00039 
00040   class GetPhysicsPropertiesResponse : public ros::Msg
00041   {
00042     public:
00043       typedef double _time_step_type;
00044       _time_step_type time_step;
00045       typedef bool _pause_type;
00046       _pause_type pause;
00047       typedef double _max_update_rate_type;
00048       _max_update_rate_type max_update_rate;
00049       typedef geometry_msgs::Vector3 _gravity_type;
00050       _gravity_type gravity;
00051       typedef gazebo_msgs::ODEPhysics _ode_config_type;
00052       _ode_config_type ode_config;
00053       typedef bool _success_type;
00054       _success_type success;
00055       typedef const char* _status_message_type;
00056       _status_message_type status_message;
00057 
00058     GetPhysicsPropertiesResponse():
00059       time_step(0),
00060       pause(0),
00061       max_update_rate(0),
00062       gravity(),
00063       ode_config(),
00064       success(0),
00065       status_message("")
00066     {
00067     }
00068 
00069     virtual int serialize(unsigned char *outbuffer) const
00070     {
00071       int offset = 0;
00072       union {
00073         double real;
00074         uint64_t base;
00075       } u_time_step;
00076       u_time_step.real = this->time_step;
00077       *(outbuffer + offset + 0) = (u_time_step.base >> (8 * 0)) & 0xFF;
00078       *(outbuffer + offset + 1) = (u_time_step.base >> (8 * 1)) & 0xFF;
00079       *(outbuffer + offset + 2) = (u_time_step.base >> (8 * 2)) & 0xFF;
00080       *(outbuffer + offset + 3) = (u_time_step.base >> (8 * 3)) & 0xFF;
00081       *(outbuffer + offset + 4) = (u_time_step.base >> (8 * 4)) & 0xFF;
00082       *(outbuffer + offset + 5) = (u_time_step.base >> (8 * 5)) & 0xFF;
00083       *(outbuffer + offset + 6) = (u_time_step.base >> (8 * 6)) & 0xFF;
00084       *(outbuffer + offset + 7) = (u_time_step.base >> (8 * 7)) & 0xFF;
00085       offset += sizeof(this->time_step);
00086       union {
00087         bool real;
00088         uint8_t base;
00089       } u_pause;
00090       u_pause.real = this->pause;
00091       *(outbuffer + offset + 0) = (u_pause.base >> (8 * 0)) & 0xFF;
00092       offset += sizeof(this->pause);
00093       union {
00094         double real;
00095         uint64_t base;
00096       } u_max_update_rate;
00097       u_max_update_rate.real = this->max_update_rate;
00098       *(outbuffer + offset + 0) = (u_max_update_rate.base >> (8 * 0)) & 0xFF;
00099       *(outbuffer + offset + 1) = (u_max_update_rate.base >> (8 * 1)) & 0xFF;
00100       *(outbuffer + offset + 2) = (u_max_update_rate.base >> (8 * 2)) & 0xFF;
00101       *(outbuffer + offset + 3) = (u_max_update_rate.base >> (8 * 3)) & 0xFF;
00102       *(outbuffer + offset + 4) = (u_max_update_rate.base >> (8 * 4)) & 0xFF;
00103       *(outbuffer + offset + 5) = (u_max_update_rate.base >> (8 * 5)) & 0xFF;
00104       *(outbuffer + offset + 6) = (u_max_update_rate.base >> (8 * 6)) & 0xFF;
00105       *(outbuffer + offset + 7) = (u_max_update_rate.base >> (8 * 7)) & 0xFF;
00106       offset += sizeof(this->max_update_rate);
00107       offset += this->gravity.serialize(outbuffer + offset);
00108       offset += this->ode_config.serialize(outbuffer + offset);
00109       union {
00110         bool real;
00111         uint8_t base;
00112       } u_success;
00113       u_success.real = this->success;
00114       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00115       offset += sizeof(this->success);
00116       uint32_t length_status_message = strlen(this->status_message);
00117       varToArr(outbuffer + offset, length_status_message);
00118       offset += 4;
00119       memcpy(outbuffer + offset, this->status_message, length_status_message);
00120       offset += length_status_message;
00121       return offset;
00122     }
00123 
00124     virtual int deserialize(unsigned char *inbuffer)
00125     {
00126       int offset = 0;
00127       union {
00128         double real;
00129         uint64_t base;
00130       } u_time_step;
00131       u_time_step.base = 0;
00132       u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00133       u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00134       u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00135       u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00136       u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00137       u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00138       u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00139       u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00140       this->time_step = u_time_step.real;
00141       offset += sizeof(this->time_step);
00142       union {
00143         bool real;
00144         uint8_t base;
00145       } u_pause;
00146       u_pause.base = 0;
00147       u_pause.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00148       this->pause = u_pause.real;
00149       offset += sizeof(this->pause);
00150       union {
00151         double real;
00152         uint64_t base;
00153       } u_max_update_rate;
00154       u_max_update_rate.base = 0;
00155       u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
00156       u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
00157       u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
00158       u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
00159       u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
00160       u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
00161       u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
00162       u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
00163       this->max_update_rate = u_max_update_rate.real;
00164       offset += sizeof(this->max_update_rate);
00165       offset += this->gravity.deserialize(inbuffer + offset);
00166       offset += this->ode_config.deserialize(inbuffer + offset);
00167       union {
00168         bool real;
00169         uint8_t base;
00170       } u_success;
00171       u_success.base = 0;
00172       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00173       this->success = u_success.real;
00174       offset += sizeof(this->success);
00175       uint32_t length_status_message;
00176       arrToVar(length_status_message, (inbuffer + offset));
00177       offset += 4;
00178       for(unsigned int k= offset; k< offset+length_status_message; ++k){
00179           inbuffer[k-1]=inbuffer[k];
00180       }
00181       inbuffer[offset+length_status_message-1]=0;
00182       this->status_message = (char *)(inbuffer + offset-1);
00183       offset += length_status_message;
00184      return offset;
00185     }
00186 
00187     const char * getType(){ return GETPHYSICSPROPERTIES; };
00188     const char * getMD5(){ return "575a5e74786981b7df2e3afc567693a6"; };
00189 
00190   };
00191 
00192   class GetPhysicsProperties {
00193     public:
00194     typedef GetPhysicsPropertiesRequest Request;
00195     typedef GetPhysicsPropertiesResponse Response;
00196   };
00197 
00198 }
00199 #endif