rosserial library for mbed Inspired by nucho's rosserial library This library is still under development

Dependencies:   MODSERIAL mbed

Dependents:   mbed_roshydro_test

Library still under development!

Committer:
akashvibhute
Date:
Sun Feb 15 10:53:43 2015 +0000
Revision:
0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akashvibhute 0:30537dec6e0b 1 #ifndef _ROS_SERVICE_GetPhysicsProperties_h
akashvibhute 0:30537dec6e0b 2 #define _ROS_SERVICE_GetPhysicsProperties_h
akashvibhute 0:30537dec6e0b 3 #include <stdint.h>
akashvibhute 0:30537dec6e0b 4 #include <string.h>
akashvibhute 0:30537dec6e0b 5 #include <stdlib.h>
akashvibhute 0:30537dec6e0b 6 #include "ros/msg.h"
akashvibhute 0:30537dec6e0b 7 #include "geometry_msgs/Vector3.h"
akashvibhute 0:30537dec6e0b 8 #include "gazebo_msgs/ODEPhysics.h"
akashvibhute 0:30537dec6e0b 9
akashvibhute 0:30537dec6e0b 10 namespace gazebo_msgs
akashvibhute 0:30537dec6e0b 11 {
akashvibhute 0:30537dec6e0b 12
akashvibhute 0:30537dec6e0b 13 static const char GETPHYSICSPROPERTIES[] = "gazebo_msgs/GetPhysicsProperties";
akashvibhute 0:30537dec6e0b 14
akashvibhute 0:30537dec6e0b 15 class GetPhysicsPropertiesRequest : public ros::Msg
akashvibhute 0:30537dec6e0b 16 {
akashvibhute 0:30537dec6e0b 17 public:
akashvibhute 0:30537dec6e0b 18
akashvibhute 0:30537dec6e0b 19 GetPhysicsPropertiesRequest()
akashvibhute 0:30537dec6e0b 20 {
akashvibhute 0:30537dec6e0b 21 }
akashvibhute 0:30537dec6e0b 22
akashvibhute 0:30537dec6e0b 23 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 24 {
akashvibhute 0:30537dec6e0b 25 int offset = 0;
akashvibhute 0:30537dec6e0b 26 return offset;
akashvibhute 0:30537dec6e0b 27 }
akashvibhute 0:30537dec6e0b 28
akashvibhute 0:30537dec6e0b 29 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 30 {
akashvibhute 0:30537dec6e0b 31 int offset = 0;
akashvibhute 0:30537dec6e0b 32 return offset;
akashvibhute 0:30537dec6e0b 33 }
akashvibhute 0:30537dec6e0b 34
akashvibhute 0:30537dec6e0b 35 const char * getType(){ return GETPHYSICSPROPERTIES; };
akashvibhute 0:30537dec6e0b 36 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
akashvibhute 0:30537dec6e0b 37
akashvibhute 0:30537dec6e0b 38 };
akashvibhute 0:30537dec6e0b 39
akashvibhute 0:30537dec6e0b 40 class GetPhysicsPropertiesResponse : public ros::Msg
akashvibhute 0:30537dec6e0b 41 {
akashvibhute 0:30537dec6e0b 42 public:
akashvibhute 0:30537dec6e0b 43 float time_step;
akashvibhute 0:30537dec6e0b 44 bool pause;
akashvibhute 0:30537dec6e0b 45 float max_update_rate;
akashvibhute 0:30537dec6e0b 46 geometry_msgs::Vector3 gravity;
akashvibhute 0:30537dec6e0b 47 gazebo_msgs::ODEPhysics ode_config;
akashvibhute 0:30537dec6e0b 48 bool success;
akashvibhute 0:30537dec6e0b 49 const char* status_message;
akashvibhute 0:30537dec6e0b 50
akashvibhute 0:30537dec6e0b 51 GetPhysicsPropertiesResponse():
akashvibhute 0:30537dec6e0b 52 time_step(0),
akashvibhute 0:30537dec6e0b 53 pause(0),
akashvibhute 0:30537dec6e0b 54 max_update_rate(0),
akashvibhute 0:30537dec6e0b 55 gravity(),
akashvibhute 0:30537dec6e0b 56 ode_config(),
akashvibhute 0:30537dec6e0b 57 success(0),
akashvibhute 0:30537dec6e0b 58 status_message("")
akashvibhute 0:30537dec6e0b 59 {
akashvibhute 0:30537dec6e0b 60 }
akashvibhute 0:30537dec6e0b 61
akashvibhute 0:30537dec6e0b 62 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 63 {
akashvibhute 0:30537dec6e0b 64 int offset = 0;
akashvibhute 0:30537dec6e0b 65 offset += serializeAvrFloat64(outbuffer + offset, this->time_step);
akashvibhute 0:30537dec6e0b 66 union {
akashvibhute 0:30537dec6e0b 67 bool real;
akashvibhute 0:30537dec6e0b 68 uint8_t base;
akashvibhute 0:30537dec6e0b 69 } u_pause;
akashvibhute 0:30537dec6e0b 70 u_pause.real = this->pause;
akashvibhute 0:30537dec6e0b 71 *(outbuffer + offset + 0) = (u_pause.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 72 offset += sizeof(this->pause);
akashvibhute 0:30537dec6e0b 73 offset += serializeAvrFloat64(outbuffer + offset, this->max_update_rate);
akashvibhute 0:30537dec6e0b 74 offset += this->gravity.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 75 offset += this->ode_config.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 76 union {
akashvibhute 0:30537dec6e0b 77 bool real;
akashvibhute 0:30537dec6e0b 78 uint8_t base;
akashvibhute 0:30537dec6e0b 79 } u_success;
akashvibhute 0:30537dec6e0b 80 u_success.real = this->success;
akashvibhute 0:30537dec6e0b 81 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 82 offset += sizeof(this->success);
akashvibhute 0:30537dec6e0b 83 uint32_t length_status_message = strlen(this->status_message);
akashvibhute 0:30537dec6e0b 84 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 85 offset += 4;
akashvibhute 0:30537dec6e0b 86 memcpy(outbuffer + offset, this->status_message, length_status_message);
akashvibhute 0:30537dec6e0b 87 offset += length_status_message;
akashvibhute 0:30537dec6e0b 88 return offset;
akashvibhute 0:30537dec6e0b 89 }
akashvibhute 0:30537dec6e0b 90
akashvibhute 0:30537dec6e0b 91 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 92 {
akashvibhute 0:30537dec6e0b 93 int offset = 0;
akashvibhute 0:30537dec6e0b 94 offset += deserializeAvrFloat64(inbuffer + offset, &(this->time_step));
akashvibhute 0:30537dec6e0b 95 union {
akashvibhute 0:30537dec6e0b 96 bool real;
akashvibhute 0:30537dec6e0b 97 uint8_t base;
akashvibhute 0:30537dec6e0b 98 } u_pause;
akashvibhute 0:30537dec6e0b 99 u_pause.base = 0;
akashvibhute 0:30537dec6e0b 100 u_pause.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 101 this->pause = u_pause.real;
akashvibhute 0:30537dec6e0b 102 offset += sizeof(this->pause);
akashvibhute 0:30537dec6e0b 103 offset += deserializeAvrFloat64(inbuffer + offset, &(this->max_update_rate));
akashvibhute 0:30537dec6e0b 104 offset += this->gravity.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 105 offset += this->ode_config.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 106 union {
akashvibhute 0:30537dec6e0b 107 bool real;
akashvibhute 0:30537dec6e0b 108 uint8_t base;
akashvibhute 0:30537dec6e0b 109 } u_success;
akashvibhute 0:30537dec6e0b 110 u_success.base = 0;
akashvibhute 0:30537dec6e0b 111 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 112 this->success = u_success.real;
akashvibhute 0:30537dec6e0b 113 offset += sizeof(this->success);
akashvibhute 0:30537dec6e0b 114 uint32_t length_status_message;
akashvibhute 0:30537dec6e0b 115 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 116 offset += 4;
akashvibhute 0:30537dec6e0b 117 for(unsigned int k= offset; k< offset+length_status_message; ++k){
akashvibhute 0:30537dec6e0b 118 inbuffer[k-1]=inbuffer[k];
akashvibhute 0:30537dec6e0b 119 }
akashvibhute 0:30537dec6e0b 120 inbuffer[offset+length_status_message-1]=0;
akashvibhute 0:30537dec6e0b 121 this->status_message = (char *)(inbuffer + offset-1);
akashvibhute 0:30537dec6e0b 122 offset += length_status_message;
akashvibhute 0:30537dec6e0b 123 return offset;
akashvibhute 0:30537dec6e0b 124 }
akashvibhute 0:30537dec6e0b 125
akashvibhute 0:30537dec6e0b 126 const char * getType(){ return GETPHYSICSPROPERTIES; };
akashvibhute 0:30537dec6e0b 127 const char * getMD5(){ return "575a5e74786981b7df2e3afc567693a6"; };
akashvibhute 0:30537dec6e0b 128
akashvibhute 0:30537dec6e0b 129 };
akashvibhute 0:30537dec6e0b 130
akashvibhute 0:30537dec6e0b 131 class GetPhysicsProperties {
akashvibhute 0:30537dec6e0b 132 public:
akashvibhute 0:30537dec6e0b 133 typedef GetPhysicsPropertiesRequest Request;
akashvibhute 0:30537dec6e0b 134 typedef GetPhysicsPropertiesResponse Response;
akashvibhute 0:30537dec6e0b 135 };
akashvibhute 0:30537dec6e0b 136
akashvibhute 0:30537dec6e0b 137 }
akashvibhute 0:30537dec6e0b 138 #endif
akashvibhute 0:30537dec6e0b 139