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