Руслан Бредун / Mbed 2 deprecated STM32-MC_node

Dependencies:   mbed Watchdog stm32-sensor-base2

Committer:
ommpy
Date:
Tue Jul 07 15:19:06 2020 +0530
Revision:
2:b7fdc74e5c5d
new board files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ommpy 2:b7fdc74e5c5d 1 #ifndef _ROS_SERVICE_SetPhysicsProperties_h
ommpy 2:b7fdc74e5c5d 2 #define _ROS_SERVICE_SetPhysicsProperties_h
ommpy 2:b7fdc74e5c5d 3 #include <stdint.h>
ommpy 2:b7fdc74e5c5d 4 #include <string.h>
ommpy 2:b7fdc74e5c5d 5 #include <stdlib.h>
ommpy 2:b7fdc74e5c5d 6 #include "ros/msg.h"
ommpy 2:b7fdc74e5c5d 7 #include "geometry_msgs/Vector3.h"
ommpy 2:b7fdc74e5c5d 8 #include "gazebo_msgs/ODEPhysics.h"
ommpy 2:b7fdc74e5c5d 9
ommpy 2:b7fdc74e5c5d 10 namespace gazebo_msgs
ommpy 2:b7fdc74e5c5d 11 {
ommpy 2:b7fdc74e5c5d 12
ommpy 2:b7fdc74e5c5d 13 static const char SETPHYSICSPROPERTIES[] = "gazebo_msgs/SetPhysicsProperties";
ommpy 2:b7fdc74e5c5d 14
ommpy 2:b7fdc74e5c5d 15 class SetPhysicsPropertiesRequest : public ros::Msg
ommpy 2:b7fdc74e5c5d 16 {
ommpy 2:b7fdc74e5c5d 17 public:
ommpy 2:b7fdc74e5c5d 18 typedef double _time_step_type;
ommpy 2:b7fdc74e5c5d 19 _time_step_type time_step;
ommpy 2:b7fdc74e5c5d 20 typedef double _max_update_rate_type;
ommpy 2:b7fdc74e5c5d 21 _max_update_rate_type max_update_rate;
ommpy 2:b7fdc74e5c5d 22 typedef geometry_msgs::Vector3 _gravity_type;
ommpy 2:b7fdc74e5c5d 23 _gravity_type gravity;
ommpy 2:b7fdc74e5c5d 24 typedef gazebo_msgs::ODEPhysics _ode_config_type;
ommpy 2:b7fdc74e5c5d 25 _ode_config_type ode_config;
ommpy 2:b7fdc74e5c5d 26
ommpy 2:b7fdc74e5c5d 27 SetPhysicsPropertiesRequest():
ommpy 2:b7fdc74e5c5d 28 time_step(0),
ommpy 2:b7fdc74e5c5d 29 max_update_rate(0),
ommpy 2:b7fdc74e5c5d 30 gravity(),
ommpy 2:b7fdc74e5c5d 31 ode_config()
ommpy 2:b7fdc74e5c5d 32 {
ommpy 2:b7fdc74e5c5d 33 }
ommpy 2:b7fdc74e5c5d 34
ommpy 2:b7fdc74e5c5d 35 virtual int serialize(unsigned char *outbuffer) const
ommpy 2:b7fdc74e5c5d 36 {
ommpy 2:b7fdc74e5c5d 37 int offset = 0;
ommpy 2:b7fdc74e5c5d 38 union {
ommpy 2:b7fdc74e5c5d 39 double real;
ommpy 2:b7fdc74e5c5d 40 uint64_t base;
ommpy 2:b7fdc74e5c5d 41 } u_time_step;
ommpy 2:b7fdc74e5c5d 42 u_time_step.real = this->time_step;
ommpy 2:b7fdc74e5c5d 43 *(outbuffer + offset + 0) = (u_time_step.base >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 44 *(outbuffer + offset + 1) = (u_time_step.base >> (8 * 1)) & 0xFF;
ommpy 2:b7fdc74e5c5d 45 *(outbuffer + offset + 2) = (u_time_step.base >> (8 * 2)) & 0xFF;
ommpy 2:b7fdc74e5c5d 46 *(outbuffer + offset + 3) = (u_time_step.base >> (8 * 3)) & 0xFF;
ommpy 2:b7fdc74e5c5d 47 *(outbuffer + offset + 4) = (u_time_step.base >> (8 * 4)) & 0xFF;
ommpy 2:b7fdc74e5c5d 48 *(outbuffer + offset + 5) = (u_time_step.base >> (8 * 5)) & 0xFF;
ommpy 2:b7fdc74e5c5d 49 *(outbuffer + offset + 6) = (u_time_step.base >> (8 * 6)) & 0xFF;
ommpy 2:b7fdc74e5c5d 50 *(outbuffer + offset + 7) = (u_time_step.base >> (8 * 7)) & 0xFF;
ommpy 2:b7fdc74e5c5d 51 offset += sizeof(this->time_step);
ommpy 2:b7fdc74e5c5d 52 union {
ommpy 2:b7fdc74e5c5d 53 double real;
ommpy 2:b7fdc74e5c5d 54 uint64_t base;
ommpy 2:b7fdc74e5c5d 55 } u_max_update_rate;
ommpy 2:b7fdc74e5c5d 56 u_max_update_rate.real = this->max_update_rate;
ommpy 2:b7fdc74e5c5d 57 *(outbuffer + offset + 0) = (u_max_update_rate.base >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 58 *(outbuffer + offset + 1) = (u_max_update_rate.base >> (8 * 1)) & 0xFF;
ommpy 2:b7fdc74e5c5d 59 *(outbuffer + offset + 2) = (u_max_update_rate.base >> (8 * 2)) & 0xFF;
ommpy 2:b7fdc74e5c5d 60 *(outbuffer + offset + 3) = (u_max_update_rate.base >> (8 * 3)) & 0xFF;
ommpy 2:b7fdc74e5c5d 61 *(outbuffer + offset + 4) = (u_max_update_rate.base >> (8 * 4)) & 0xFF;
ommpy 2:b7fdc74e5c5d 62 *(outbuffer + offset + 5) = (u_max_update_rate.base >> (8 * 5)) & 0xFF;
ommpy 2:b7fdc74e5c5d 63 *(outbuffer + offset + 6) = (u_max_update_rate.base >> (8 * 6)) & 0xFF;
ommpy 2:b7fdc74e5c5d 64 *(outbuffer + offset + 7) = (u_max_update_rate.base >> (8 * 7)) & 0xFF;
ommpy 2:b7fdc74e5c5d 65 offset += sizeof(this->max_update_rate);
ommpy 2:b7fdc74e5c5d 66 offset += this->gravity.serialize(outbuffer + offset);
ommpy 2:b7fdc74e5c5d 67 offset += this->ode_config.serialize(outbuffer + offset);
ommpy 2:b7fdc74e5c5d 68 return offset;
ommpy 2:b7fdc74e5c5d 69 }
ommpy 2:b7fdc74e5c5d 70
ommpy 2:b7fdc74e5c5d 71 virtual int deserialize(unsigned char *inbuffer)
ommpy 2:b7fdc74e5c5d 72 {
ommpy 2:b7fdc74e5c5d 73 int offset = 0;
ommpy 2:b7fdc74e5c5d 74 union {
ommpy 2:b7fdc74e5c5d 75 double real;
ommpy 2:b7fdc74e5c5d 76 uint64_t base;
ommpy 2:b7fdc74e5c5d 77 } u_time_step;
ommpy 2:b7fdc74e5c5d 78 u_time_step.base = 0;
ommpy 2:b7fdc74e5c5d 79 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
ommpy 2:b7fdc74e5c5d 80 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
ommpy 2:b7fdc74e5c5d 81 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
ommpy 2:b7fdc74e5c5d 82 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
ommpy 2:b7fdc74e5c5d 83 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
ommpy 2:b7fdc74e5c5d 84 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
ommpy 2:b7fdc74e5c5d 85 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
ommpy 2:b7fdc74e5c5d 86 u_time_step.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
ommpy 2:b7fdc74e5c5d 87 this->time_step = u_time_step.real;
ommpy 2:b7fdc74e5c5d 88 offset += sizeof(this->time_step);
ommpy 2:b7fdc74e5c5d 89 union {
ommpy 2:b7fdc74e5c5d 90 double real;
ommpy 2:b7fdc74e5c5d 91 uint64_t base;
ommpy 2:b7fdc74e5c5d 92 } u_max_update_rate;
ommpy 2:b7fdc74e5c5d 93 u_max_update_rate.base = 0;
ommpy 2:b7fdc74e5c5d 94 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
ommpy 2:b7fdc74e5c5d 95 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
ommpy 2:b7fdc74e5c5d 96 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
ommpy 2:b7fdc74e5c5d 97 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
ommpy 2:b7fdc74e5c5d 98 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
ommpy 2:b7fdc74e5c5d 99 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
ommpy 2:b7fdc74e5c5d 100 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
ommpy 2:b7fdc74e5c5d 101 u_max_update_rate.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
ommpy 2:b7fdc74e5c5d 102 this->max_update_rate = u_max_update_rate.real;
ommpy 2:b7fdc74e5c5d 103 offset += sizeof(this->max_update_rate);
ommpy 2:b7fdc74e5c5d 104 offset += this->gravity.deserialize(inbuffer + offset);
ommpy 2:b7fdc74e5c5d 105 offset += this->ode_config.deserialize(inbuffer + offset);
ommpy 2:b7fdc74e5c5d 106 return offset;
ommpy 2:b7fdc74e5c5d 107 }
ommpy 2:b7fdc74e5c5d 108
ommpy 2:b7fdc74e5c5d 109 const char * getType(){ return SETPHYSICSPROPERTIES; };
ommpy 2:b7fdc74e5c5d 110 const char * getMD5(){ return "abd9f82732b52b92e9d6bb36e6a82452"; };
ommpy 2:b7fdc74e5c5d 111
ommpy 2:b7fdc74e5c5d 112 };
ommpy 2:b7fdc74e5c5d 113
ommpy 2:b7fdc74e5c5d 114 class SetPhysicsPropertiesResponse : public ros::Msg
ommpy 2:b7fdc74e5c5d 115 {
ommpy 2:b7fdc74e5c5d 116 public:
ommpy 2:b7fdc74e5c5d 117 typedef bool _success_type;
ommpy 2:b7fdc74e5c5d 118 _success_type success;
ommpy 2:b7fdc74e5c5d 119 typedef const char* _status_message_type;
ommpy 2:b7fdc74e5c5d 120 _status_message_type status_message;
ommpy 2:b7fdc74e5c5d 121
ommpy 2:b7fdc74e5c5d 122 SetPhysicsPropertiesResponse():
ommpy 2:b7fdc74e5c5d 123 success(0),
ommpy 2:b7fdc74e5c5d 124 status_message("")
ommpy 2:b7fdc74e5c5d 125 {
ommpy 2:b7fdc74e5c5d 126 }
ommpy 2:b7fdc74e5c5d 127
ommpy 2:b7fdc74e5c5d 128 virtual int serialize(unsigned char *outbuffer) const
ommpy 2:b7fdc74e5c5d 129 {
ommpy 2:b7fdc74e5c5d 130 int offset = 0;
ommpy 2:b7fdc74e5c5d 131 union {
ommpy 2:b7fdc74e5c5d 132 bool real;
ommpy 2:b7fdc74e5c5d 133 uint8_t base;
ommpy 2:b7fdc74e5c5d 134 } u_success;
ommpy 2:b7fdc74e5c5d 135 u_success.real = this->success;
ommpy 2:b7fdc74e5c5d 136 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 137 offset += sizeof(this->success);
ommpy 2:b7fdc74e5c5d 138 uint32_t length_status_message = strlen(this->status_message);
ommpy 2:b7fdc74e5c5d 139 varToArr(outbuffer + offset, length_status_message);
ommpy 2:b7fdc74e5c5d 140 offset += 4;
ommpy 2:b7fdc74e5c5d 141 memcpy(outbuffer + offset, this->status_message, length_status_message);
ommpy 2:b7fdc74e5c5d 142 offset += length_status_message;
ommpy 2:b7fdc74e5c5d 143 return offset;
ommpy 2:b7fdc74e5c5d 144 }
ommpy 2:b7fdc74e5c5d 145
ommpy 2:b7fdc74e5c5d 146 virtual int deserialize(unsigned char *inbuffer)
ommpy 2:b7fdc74e5c5d 147 {
ommpy 2:b7fdc74e5c5d 148 int offset = 0;
ommpy 2:b7fdc74e5c5d 149 union {
ommpy 2:b7fdc74e5c5d 150 bool real;
ommpy 2:b7fdc74e5c5d 151 uint8_t base;
ommpy 2:b7fdc74e5c5d 152 } u_success;
ommpy 2:b7fdc74e5c5d 153 u_success.base = 0;
ommpy 2:b7fdc74e5c5d 154 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
ommpy 2:b7fdc74e5c5d 155 this->success = u_success.real;
ommpy 2:b7fdc74e5c5d 156 offset += sizeof(this->success);
ommpy 2:b7fdc74e5c5d 157 uint32_t length_status_message;
ommpy 2:b7fdc74e5c5d 158 arrToVar(length_status_message, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 159 offset += 4;
ommpy 2:b7fdc74e5c5d 160 for(unsigned int k= offset; k< offset+length_status_message; ++k){
ommpy 2:b7fdc74e5c5d 161 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 162 }
ommpy 2:b7fdc74e5c5d 163 inbuffer[offset+length_status_message-1]=0;
ommpy 2:b7fdc74e5c5d 164 this->status_message = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 165 offset += length_status_message;
ommpy 2:b7fdc74e5c5d 166 return offset;
ommpy 2:b7fdc74e5c5d 167 }
ommpy 2:b7fdc74e5c5d 168
ommpy 2:b7fdc74e5c5d 169 const char * getType(){ return SETPHYSICSPROPERTIES; };
ommpy 2:b7fdc74e5c5d 170 const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; };
ommpy 2:b7fdc74e5c5d 171
ommpy 2:b7fdc74e5c5d 172 };
ommpy 2:b7fdc74e5c5d 173
ommpy 2:b7fdc74e5c5d 174 class SetPhysicsProperties {
ommpy 2:b7fdc74e5c5d 175 public:
ommpy 2:b7fdc74e5c5d 176 typedef SetPhysicsPropertiesRequest Request;
ommpy 2:b7fdc74e5c5d 177 typedef SetPhysicsPropertiesResponse Response;
ommpy 2:b7fdc74e5c5d 178 };
ommpy 2:b7fdc74e5c5d 179
ommpy 2:b7fdc74e5c5d 180 }
ommpy 2:b7fdc74e5c5d 181 #endif