ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

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