ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
SetPhysicsProperties.h
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 double time_step; 00019 double max_update_rate; 00020 geometry_msgs::Vector3 gravity; 00021 gazebo_msgs::ODEPhysics ode_config; 00022 00023 SetPhysicsPropertiesRequest(): 00024 time_step(0), 00025 max_update_rate(0), 00026 gravity(), 00027 ode_config() 00028 { 00029 } 00030 00031 virtual int serialize(unsigned char *outbuffer) const 00032 { 00033 int offset = 0; 00034 union { 00035 double real; 00036 uint64_t base; 00037 } u_time_step; 00038 u_time_step.real = this->time_step; 00039 *(outbuffer + offset + 0) = (u_time_step.base >> (8 * 0)) & 0xFF; 00040 *(outbuffer + offset + 1) = (u_time_step.base >> (8 * 1)) & 0xFF; 00041 *(outbuffer + offset + 2) = (u_time_step.base >> (8 * 2)) & 0xFF; 00042 *(outbuffer + offset + 3) = (u_time_step.base >> (8 * 3)) & 0xFF; 00043 *(outbuffer + offset + 4) = (u_time_step.base >> (8 * 4)) & 0xFF; 00044 *(outbuffer + offset + 5) = (u_time_step.base >> (8 * 5)) & 0xFF; 00045 *(outbuffer + offset + 6) = (u_time_step.base >> (8 * 6)) & 0xFF; 00046 *(outbuffer + offset + 7) = (u_time_step.base >> (8 * 7)) & 0xFF; 00047 offset += sizeof(this->time_step); 00048 union { 00049 double real; 00050 uint64_t base; 00051 } u_max_update_rate; 00052 u_max_update_rate.real = this->max_update_rate; 00053 *(outbuffer + offset + 0) = (u_max_update_rate.base >> (8 * 0)) & 0xFF; 00054 *(outbuffer + offset + 1) = (u_max_update_rate.base >> (8 * 1)) & 0xFF; 00055 *(outbuffer + offset + 2) = (u_max_update_rate.base >> (8 * 2)) & 0xFF; 00056 *(outbuffer + offset + 3) = (u_max_update_rate.base >> (8 * 3)) & 0xFF; 00057 *(outbuffer + offset + 4) = (u_max_update_rate.base >> (8 * 4)) & 0xFF; 00058 *(outbuffer + offset + 5) = (u_max_update_rate.base >> (8 * 5)) & 0xFF; 00059 *(outbuffer + offset + 6) = (u_max_update_rate.base >> (8 * 6)) & 0xFF; 00060 *(outbuffer + offset + 7) = (u_max_update_rate.base >> (8 * 7)) & 0xFF; 00061 offset += sizeof(this->max_update_rate); 00062 offset += this->gravity.serialize(outbuffer + offset); 00063 offset += this->ode_config.serialize(outbuffer + offset); 00064 return offset; 00065 } 00066 00067 virtual int deserialize(unsigned char *inbuffer) 00068 { 00069 int offset = 0; 00070 union { 00071 double real; 00072 uint64_t base; 00073 } u_time_step; 00074 u_time_step.base = 0; 00075 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00076 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00077 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00078 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00079 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00080 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00081 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00082 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00083 this->time_step = u_time_step.real; 00084 offset += sizeof(this->time_step); 00085 union { 00086 double real; 00087 uint64_t base; 00088 } u_max_update_rate; 00089 u_max_update_rate.base = 0; 00090 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00091 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00092 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00093 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00094 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00095 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00096 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00097 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00098 this->max_update_rate = u_max_update_rate.real; 00099 offset += sizeof(this->max_update_rate); 00100 offset += this->gravity.deserialize(inbuffer + offset); 00101 offset += this->ode_config.deserialize(inbuffer + offset); 00102 return offset; 00103 } 00104 00105 const char * getType(){ return SETPHYSICSPROPERTIES; }; 00106 const char * getMD5(){ return "abd9f82732b52b92e9d6bb36e6a82452"; }; 00107 00108 }; 00109 00110 class SetPhysicsPropertiesResponse : public ros::Msg 00111 { 00112 public: 00113 bool success; 00114 const char* status_message; 00115 00116 SetPhysicsPropertiesResponse(): 00117 success(0), 00118 status_message("") 00119 { 00120 } 00121 00122 virtual int serialize(unsigned char *outbuffer) const 00123 { 00124 int offset = 0; 00125 union { 00126 bool real; 00127 uint8_t base; 00128 } u_success; 00129 u_success.real = this->success; 00130 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; 00131 offset += sizeof(this->success); 00132 uint32_t length_status_message = strlen(this->status_message); 00133 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t)); 00134 offset += 4; 00135 memcpy(outbuffer + offset, this->status_message, length_status_message); 00136 offset += length_status_message; 00137 return offset; 00138 } 00139 00140 virtual int deserialize(unsigned char *inbuffer) 00141 { 00142 int offset = 0; 00143 union { 00144 bool real; 00145 uint8_t base; 00146 } u_success; 00147 u_success.base = 0; 00148 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00149 this->success = u_success.real; 00150 offset += sizeof(this->success); 00151 uint32_t length_status_message; 00152 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t)); 00153 offset += 4; 00154 for(unsigned int k= offset; k< offset+length_status_message; ++k){ 00155 inbuffer[k-1]=inbuffer[k]; 00156 } 00157 inbuffer[offset+length_status_message-1]=0; 00158 this->status_message = (char *)(inbuffer + offset-1); 00159 offset += length_status_message; 00160 return offset; 00161 } 00162 00163 const char * getType(){ return SETPHYSICSPROPERTIES; }; 00164 const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; }; 00165 00166 }; 00167 00168 class SetPhysicsProperties { 00169 public: 00170 typedef SetPhysicsPropertiesRequest Request; 00171 typedef SetPhysicsPropertiesResponse Response; 00172 }; 00173 00174 } 00175 #endif
Generated on Tue Jul 12 2022 18:39:41 by 1.7.2