added 1 custom message
Fork of ros_lib_kinetic by
gazebo_msgs/GetPhysicsProperties.h@2:af816ffd33df, 2017-05-19 (annotated)
- Committer:
- randalthor
- Date:
- Fri May 19 08:59:12 2017 +0000
- Revision:
- 2:af816ffd33df
- Parent:
- 0:9e9b7db60fd5
custom message mobile robot added for ITU cyber physical lab
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_SERVICE_GetPhysicsProperties_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_SERVICE_GetPhysicsProperties_h |
garyservin | 0:9e9b7db60fd5 | 3 | #include <stdint.h> |
garyservin | 0:9e9b7db60fd5 | 4 | #include <string.h> |
garyservin | 0:9e9b7db60fd5 | 5 | #include <stdlib.h> |
garyservin | 0:9e9b7db60fd5 | 6 | #include "ros/msg.h" |
garyservin | 0:9e9b7db60fd5 | 7 | #include "geometry_msgs/Vector3.h" |
garyservin | 0:9e9b7db60fd5 | 8 | #include "gazebo_msgs/ODEPhysics.h" |
garyservin | 0:9e9b7db60fd5 | 9 | |
garyservin | 0:9e9b7db60fd5 | 10 | namespace gazebo_msgs |
garyservin | 0:9e9b7db60fd5 | 11 | { |
garyservin | 0:9e9b7db60fd5 | 12 | |
garyservin | 0:9e9b7db60fd5 | 13 | static const char GETPHYSICSPROPERTIES[] = "gazebo_msgs/GetPhysicsProperties"; |
garyservin | 0:9e9b7db60fd5 | 14 | |
garyservin | 0:9e9b7db60fd5 | 15 | class GetPhysicsPropertiesRequest : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 16 | { |
garyservin | 0:9e9b7db60fd5 | 17 | public: |
garyservin | 0:9e9b7db60fd5 | 18 | |
garyservin | 0:9e9b7db60fd5 | 19 | GetPhysicsPropertiesRequest() |
garyservin | 0:9e9b7db60fd5 | 20 | { |
garyservin | 0:9e9b7db60fd5 | 21 | } |
garyservin | 0:9e9b7db60fd5 | 22 | |
garyservin | 0:9e9b7db60fd5 | 23 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 24 | { |
garyservin | 0:9e9b7db60fd5 | 25 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 26 | return offset; |
garyservin | 0:9e9b7db60fd5 | 27 | } |
garyservin | 0:9e9b7db60fd5 | 28 | |
garyservin | 0:9e9b7db60fd5 | 29 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 30 | { |
garyservin | 0:9e9b7db60fd5 | 31 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 32 | return offset; |
garyservin | 0:9e9b7db60fd5 | 33 | } |
garyservin | 0:9e9b7db60fd5 | 34 | |
garyservin | 0:9e9b7db60fd5 | 35 | const char * getType(){ return GETPHYSICSPROPERTIES; }; |
garyservin | 0:9e9b7db60fd5 | 36 | const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; |
garyservin | 0:9e9b7db60fd5 | 37 | |
garyservin | 0:9e9b7db60fd5 | 38 | }; |
garyservin | 0:9e9b7db60fd5 | 39 | |
garyservin | 0:9e9b7db60fd5 | 40 | class GetPhysicsPropertiesResponse : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 41 | { |
garyservin | 0:9e9b7db60fd5 | 42 | public: |
garyservin | 0:9e9b7db60fd5 | 43 | typedef double _time_step_type; |
garyservin | 0:9e9b7db60fd5 | 44 | _time_step_type time_step; |
garyservin | 0:9e9b7db60fd5 | 45 | typedef bool _pause_type; |
garyservin | 0:9e9b7db60fd5 | 46 | _pause_type pause; |
garyservin | 0:9e9b7db60fd5 | 47 | typedef double _max_update_rate_type; |
garyservin | 0:9e9b7db60fd5 | 48 | _max_update_rate_type max_update_rate; |
garyservin | 0:9e9b7db60fd5 | 49 | typedef geometry_msgs::Vector3 _gravity_type; |
garyservin | 0:9e9b7db60fd5 | 50 | _gravity_type gravity; |
garyservin | 0:9e9b7db60fd5 | 51 | typedef gazebo_msgs::ODEPhysics _ode_config_type; |
garyservin | 0:9e9b7db60fd5 | 52 | _ode_config_type ode_config; |
garyservin | 0:9e9b7db60fd5 | 53 | typedef bool _success_type; |
garyservin | 0:9e9b7db60fd5 | 54 | _success_type success; |
garyservin | 0:9e9b7db60fd5 | 55 | typedef const char* _status_message_type; |
garyservin | 0:9e9b7db60fd5 | 56 | _status_message_type status_message; |
garyservin | 0:9e9b7db60fd5 | 57 | |
garyservin | 0:9e9b7db60fd5 | 58 | GetPhysicsPropertiesResponse(): |
garyservin | 0:9e9b7db60fd5 | 59 | time_step(0), |
garyservin | 0:9e9b7db60fd5 | 60 | pause(0), |
garyservin | 0:9e9b7db60fd5 | 61 | max_update_rate(0), |
garyservin | 0:9e9b7db60fd5 | 62 | gravity(), |
garyservin | 0:9e9b7db60fd5 | 63 | ode_config(), |
garyservin | 0:9e9b7db60fd5 | 64 | success(0), |
garyservin | 0:9e9b7db60fd5 | 65 | status_message("") |
garyservin | 0:9e9b7db60fd5 | 66 | { |
garyservin | 0:9e9b7db60fd5 | 67 | } |
garyservin | 0:9e9b7db60fd5 | 68 | |
garyservin | 0:9e9b7db60fd5 | 69 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 70 | { |
garyservin | 0:9e9b7db60fd5 | 71 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 72 | union { |
garyservin | 0:9e9b7db60fd5 | 73 | double real; |
garyservin | 0:9e9b7db60fd5 | 74 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 75 | } u_time_step; |
garyservin | 0:9e9b7db60fd5 | 76 | u_time_step.real = this->time_step; |
garyservin | 0:9e9b7db60fd5 | 77 | *(outbuffer + offset + 0) = (u_time_step.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 78 | *(outbuffer + offset + 1) = (u_time_step.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 79 | *(outbuffer + offset + 2) = (u_time_step.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 80 | *(outbuffer + offset + 3) = (u_time_step.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 81 | *(outbuffer + offset + 4) = (u_time_step.base >> (8 * 4)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 82 | *(outbuffer + offset + 5) = (u_time_step.base >> (8 * 5)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 83 | *(outbuffer + offset + 6) = (u_time_step.base >> (8 * 6)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 84 | *(outbuffer + offset + 7) = (u_time_step.base >> (8 * 7)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 85 | offset += sizeof(this->time_step); |
garyservin | 0:9e9b7db60fd5 | 86 | union { |
garyservin | 0:9e9b7db60fd5 | 87 | bool real; |
garyservin | 0:9e9b7db60fd5 | 88 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 89 | } u_pause; |
garyservin | 0:9e9b7db60fd5 | 90 | u_pause.real = this->pause; |
garyservin | 0:9e9b7db60fd5 | 91 | *(outbuffer + offset + 0) = (u_pause.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 92 | offset += sizeof(this->pause); |
garyservin | 0:9e9b7db60fd5 | 93 | union { |
garyservin | 0:9e9b7db60fd5 | 94 | double real; |
garyservin | 0:9e9b7db60fd5 | 95 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 96 | } u_max_update_rate; |
garyservin | 0:9e9b7db60fd5 | 97 | u_max_update_rate.real = this->max_update_rate; |
garyservin | 0:9e9b7db60fd5 | 98 | *(outbuffer + offset + 0) = (u_max_update_rate.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 99 | *(outbuffer + offset + 1) = (u_max_update_rate.base >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 100 | *(outbuffer + offset + 2) = (u_max_update_rate.base >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 101 | *(outbuffer + offset + 3) = (u_max_update_rate.base >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 102 | *(outbuffer + offset + 4) = (u_max_update_rate.base >> (8 * 4)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 103 | *(outbuffer + offset + 5) = (u_max_update_rate.base >> (8 * 5)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 104 | *(outbuffer + offset + 6) = (u_max_update_rate.base >> (8 * 6)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 105 | *(outbuffer + offset + 7) = (u_max_update_rate.base >> (8 * 7)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 106 | offset += sizeof(this->max_update_rate); |
garyservin | 0:9e9b7db60fd5 | 107 | offset += this->gravity.serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 108 | offset += this->ode_config.serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 109 | union { |
garyservin | 0:9e9b7db60fd5 | 110 | bool real; |
garyservin | 0:9e9b7db60fd5 | 111 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 112 | } u_success; |
garyservin | 0:9e9b7db60fd5 | 113 | u_success.real = this->success; |
garyservin | 0:9e9b7db60fd5 | 114 | *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 115 | offset += sizeof(this->success); |
garyservin | 0:9e9b7db60fd5 | 116 | uint32_t length_status_message = strlen(this->status_message); |
garyservin | 0:9e9b7db60fd5 | 117 | varToArr(outbuffer + offset, length_status_message); |
garyservin | 0:9e9b7db60fd5 | 118 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 119 | memcpy(outbuffer + offset, this->status_message, length_status_message); |
garyservin | 0:9e9b7db60fd5 | 120 | offset += length_status_message; |
garyservin | 0:9e9b7db60fd5 | 121 | return offset; |
garyservin | 0:9e9b7db60fd5 | 122 | } |
garyservin | 0:9e9b7db60fd5 | 123 | |
garyservin | 0:9e9b7db60fd5 | 124 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 125 | { |
garyservin | 0:9e9b7db60fd5 | 126 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 127 | union { |
garyservin | 0:9e9b7db60fd5 | 128 | double real; |
garyservin | 0:9e9b7db60fd5 | 129 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 130 | } u_time_step; |
garyservin | 0:9e9b7db60fd5 | 131 | u_time_step.base = 0; |
garyservin | 0:9e9b7db60fd5 | 132 | u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 133 | u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 134 | u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 135 | u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 136 | u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:9e9b7db60fd5 | 137 | u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:9e9b7db60fd5 | 138 | u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:9e9b7db60fd5 | 139 | u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:9e9b7db60fd5 | 140 | this->time_step = u_time_step.real; |
garyservin | 0:9e9b7db60fd5 | 141 | offset += sizeof(this->time_step); |
garyservin | 0:9e9b7db60fd5 | 142 | union { |
garyservin | 0:9e9b7db60fd5 | 143 | bool real; |
garyservin | 0:9e9b7db60fd5 | 144 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 145 | } u_pause; |
garyservin | 0:9e9b7db60fd5 | 146 | u_pause.base = 0; |
garyservin | 0:9e9b7db60fd5 | 147 | u_pause.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 148 | this->pause = u_pause.real; |
garyservin | 0:9e9b7db60fd5 | 149 | offset += sizeof(this->pause); |
garyservin | 0:9e9b7db60fd5 | 150 | union { |
garyservin | 0:9e9b7db60fd5 | 151 | double real; |
garyservin | 0:9e9b7db60fd5 | 152 | uint64_t base; |
garyservin | 0:9e9b7db60fd5 | 153 | } u_max_update_rate; |
garyservin | 0:9e9b7db60fd5 | 154 | u_max_update_rate.base = 0; |
garyservin | 0:9e9b7db60fd5 | 155 | u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 156 | u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 157 | u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 158 | u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 159 | u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); |
garyservin | 0:9e9b7db60fd5 | 160 | u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); |
garyservin | 0:9e9b7db60fd5 | 161 | u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); |
garyservin | 0:9e9b7db60fd5 | 162 | u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); |
garyservin | 0:9e9b7db60fd5 | 163 | this->max_update_rate = u_max_update_rate.real; |
garyservin | 0:9e9b7db60fd5 | 164 | offset += sizeof(this->max_update_rate); |
garyservin | 0:9e9b7db60fd5 | 165 | offset += this->gravity.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 166 | offset += this->ode_config.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 167 | union { |
garyservin | 0:9e9b7db60fd5 | 168 | bool real; |
garyservin | 0:9e9b7db60fd5 | 169 | uint8_t base; |
garyservin | 0:9e9b7db60fd5 | 170 | } u_success; |
garyservin | 0:9e9b7db60fd5 | 171 | u_success.base = 0; |
garyservin | 0:9e9b7db60fd5 | 172 | u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
garyservin | 0:9e9b7db60fd5 | 173 | this->success = u_success.real; |
garyservin | 0:9e9b7db60fd5 | 174 | offset += sizeof(this->success); |
garyservin | 0:9e9b7db60fd5 | 175 | uint32_t length_status_message; |
garyservin | 0:9e9b7db60fd5 | 176 | arrToVar(length_status_message, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 177 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 178 | for(unsigned int k= offset; k< offset+length_status_message; ++k){ |
garyservin | 0:9e9b7db60fd5 | 179 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 180 | } |
garyservin | 0:9e9b7db60fd5 | 181 | inbuffer[offset+length_status_message-1]=0; |
garyservin | 0:9e9b7db60fd5 | 182 | this->status_message = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 183 | offset += length_status_message; |
garyservin | 0:9e9b7db60fd5 | 184 | return offset; |
garyservin | 0:9e9b7db60fd5 | 185 | } |
garyservin | 0:9e9b7db60fd5 | 186 | |
garyservin | 0:9e9b7db60fd5 | 187 | const char * getType(){ return GETPHYSICSPROPERTIES; }; |
garyservin | 0:9e9b7db60fd5 | 188 | const char * getMD5(){ return "575a5e74786981b7df2e3afc567693a6"; }; |
garyservin | 0:9e9b7db60fd5 | 189 | |
garyservin | 0:9e9b7db60fd5 | 190 | }; |
garyservin | 0:9e9b7db60fd5 | 191 | |
garyservin | 0:9e9b7db60fd5 | 192 | class GetPhysicsProperties { |
garyservin | 0:9e9b7db60fd5 | 193 | public: |
garyservin | 0:9e9b7db60fd5 | 194 | typedef GetPhysicsPropertiesRequest Request; |
garyservin | 0:9e9b7db60fd5 | 195 | typedef GetPhysicsPropertiesResponse Response; |
garyservin | 0:9e9b7db60fd5 | 196 | }; |
garyservin | 0:9e9b7db60fd5 | 197 | |
garyservin | 0:9e9b7db60fd5 | 198 | } |
garyservin | 0:9e9b7db60fd5 | 199 | #endif |