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_SetLinkProperties_h
akashvibhute 0:30537dec6e0b 2 #define _ROS_SERVICE_SetLinkProperties_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/Pose.h"
akashvibhute 0:30537dec6e0b 8
akashvibhute 0:30537dec6e0b 9 namespace gazebo_msgs
akashvibhute 0:30537dec6e0b 10 {
akashvibhute 0:30537dec6e0b 11
akashvibhute 0:30537dec6e0b 12 static const char SETLINKPROPERTIES[] = "gazebo_msgs/SetLinkProperties";
akashvibhute 0:30537dec6e0b 13
akashvibhute 0:30537dec6e0b 14 class SetLinkPropertiesRequest : public ros::Msg
akashvibhute 0:30537dec6e0b 15 {
akashvibhute 0:30537dec6e0b 16 public:
akashvibhute 0:30537dec6e0b 17 const char* link_name;
akashvibhute 0:30537dec6e0b 18 geometry_msgs::Pose com;
akashvibhute 0:30537dec6e0b 19 bool gravity_mode;
akashvibhute 0:30537dec6e0b 20 float mass;
akashvibhute 0:30537dec6e0b 21 float ixx;
akashvibhute 0:30537dec6e0b 22 float ixy;
akashvibhute 0:30537dec6e0b 23 float ixz;
akashvibhute 0:30537dec6e0b 24 float iyy;
akashvibhute 0:30537dec6e0b 25 float iyz;
akashvibhute 0:30537dec6e0b 26 float izz;
akashvibhute 0:30537dec6e0b 27
akashvibhute 0:30537dec6e0b 28 SetLinkPropertiesRequest():
akashvibhute 0:30537dec6e0b 29 link_name(""),
akashvibhute 0:30537dec6e0b 30 com(),
akashvibhute 0:30537dec6e0b 31 gravity_mode(0),
akashvibhute 0:30537dec6e0b 32 mass(0),
akashvibhute 0:30537dec6e0b 33 ixx(0),
akashvibhute 0:30537dec6e0b 34 ixy(0),
akashvibhute 0:30537dec6e0b 35 ixz(0),
akashvibhute 0:30537dec6e0b 36 iyy(0),
akashvibhute 0:30537dec6e0b 37 iyz(0),
akashvibhute 0:30537dec6e0b 38 izz(0)
akashvibhute 0:30537dec6e0b 39 {
akashvibhute 0:30537dec6e0b 40 }
akashvibhute 0:30537dec6e0b 41
akashvibhute 0:30537dec6e0b 42 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 43 {
akashvibhute 0:30537dec6e0b 44 int offset = 0;
akashvibhute 0:30537dec6e0b 45 uint32_t length_link_name = strlen(this->link_name);
akashvibhute 0:30537dec6e0b 46 memcpy(outbuffer + offset, &length_link_name, sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 47 offset += 4;
akashvibhute 0:30537dec6e0b 48 memcpy(outbuffer + offset, this->link_name, length_link_name);
akashvibhute 0:30537dec6e0b 49 offset += length_link_name;
akashvibhute 0:30537dec6e0b 50 offset += this->com.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 51 union {
akashvibhute 0:30537dec6e0b 52 bool real;
akashvibhute 0:30537dec6e0b 53 uint8_t base;
akashvibhute 0:30537dec6e0b 54 } u_gravity_mode;
akashvibhute 0:30537dec6e0b 55 u_gravity_mode.real = this->gravity_mode;
akashvibhute 0:30537dec6e0b 56 *(outbuffer + offset + 0) = (u_gravity_mode.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 57 offset += sizeof(this->gravity_mode);
akashvibhute 0:30537dec6e0b 58 offset += serializeAvrFloat64(outbuffer + offset, this->mass);
akashvibhute 0:30537dec6e0b 59 offset += serializeAvrFloat64(outbuffer + offset, this->ixx);
akashvibhute 0:30537dec6e0b 60 offset += serializeAvrFloat64(outbuffer + offset, this->ixy);
akashvibhute 0:30537dec6e0b 61 offset += serializeAvrFloat64(outbuffer + offset, this->ixz);
akashvibhute 0:30537dec6e0b 62 offset += serializeAvrFloat64(outbuffer + offset, this->iyy);
akashvibhute 0:30537dec6e0b 63 offset += serializeAvrFloat64(outbuffer + offset, this->iyz);
akashvibhute 0:30537dec6e0b 64 offset += serializeAvrFloat64(outbuffer + offset, this->izz);
akashvibhute 0:30537dec6e0b 65 return offset;
akashvibhute 0:30537dec6e0b 66 }
akashvibhute 0:30537dec6e0b 67
akashvibhute 0:30537dec6e0b 68 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 69 {
akashvibhute 0:30537dec6e0b 70 int offset = 0;
akashvibhute 0:30537dec6e0b 71 uint32_t length_link_name;
akashvibhute 0:30537dec6e0b 72 memcpy(&length_link_name, (inbuffer + offset), sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 73 offset += 4;
akashvibhute 0:30537dec6e0b 74 for(unsigned int k= offset; k< offset+length_link_name; ++k){
akashvibhute 0:30537dec6e0b 75 inbuffer[k-1]=inbuffer[k];
akashvibhute 0:30537dec6e0b 76 }
akashvibhute 0:30537dec6e0b 77 inbuffer[offset+length_link_name-1]=0;
akashvibhute 0:30537dec6e0b 78 this->link_name = (char *)(inbuffer + offset-1);
akashvibhute 0:30537dec6e0b 79 offset += length_link_name;
akashvibhute 0:30537dec6e0b 80 offset += this->com.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 81 union {
akashvibhute 0:30537dec6e0b 82 bool real;
akashvibhute 0:30537dec6e0b 83 uint8_t base;
akashvibhute 0:30537dec6e0b 84 } u_gravity_mode;
akashvibhute 0:30537dec6e0b 85 u_gravity_mode.base = 0;
akashvibhute 0:30537dec6e0b 86 u_gravity_mode.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 87 this->gravity_mode = u_gravity_mode.real;
akashvibhute 0:30537dec6e0b 88 offset += sizeof(this->gravity_mode);
akashvibhute 0:30537dec6e0b 89 offset += deserializeAvrFloat64(inbuffer + offset, &(this->mass));
akashvibhute 0:30537dec6e0b 90 offset += deserializeAvrFloat64(inbuffer + offset, &(this->ixx));
akashvibhute 0:30537dec6e0b 91 offset += deserializeAvrFloat64(inbuffer + offset, &(this->ixy));
akashvibhute 0:30537dec6e0b 92 offset += deserializeAvrFloat64(inbuffer + offset, &(this->ixz));
akashvibhute 0:30537dec6e0b 93 offset += deserializeAvrFloat64(inbuffer + offset, &(this->iyy));
akashvibhute 0:30537dec6e0b 94 offset += deserializeAvrFloat64(inbuffer + offset, &(this->iyz));
akashvibhute 0:30537dec6e0b 95 offset += deserializeAvrFloat64(inbuffer + offset, &(this->izz));
akashvibhute 0:30537dec6e0b 96 return offset;
akashvibhute 0:30537dec6e0b 97 }
akashvibhute 0:30537dec6e0b 98
akashvibhute 0:30537dec6e0b 99 const char * getType(){ return SETLINKPROPERTIES; };
akashvibhute 0:30537dec6e0b 100 const char * getMD5(){ return "68ac74a4be01b165bc305b5ccdc45e91"; };
akashvibhute 0:30537dec6e0b 101
akashvibhute 0:30537dec6e0b 102 };
akashvibhute 0:30537dec6e0b 103
akashvibhute 0:30537dec6e0b 104 class SetLinkPropertiesResponse : public ros::Msg
akashvibhute 0:30537dec6e0b 105 {
akashvibhute 0:30537dec6e0b 106 public:
akashvibhute 0:30537dec6e0b 107 bool success;
akashvibhute 0:30537dec6e0b 108 const char* status_message;
akashvibhute 0:30537dec6e0b 109
akashvibhute 0:30537dec6e0b 110 SetLinkPropertiesResponse():
akashvibhute 0:30537dec6e0b 111 success(0),
akashvibhute 0:30537dec6e0b 112 status_message("")
akashvibhute 0:30537dec6e0b 113 {
akashvibhute 0:30537dec6e0b 114 }
akashvibhute 0:30537dec6e0b 115
akashvibhute 0:30537dec6e0b 116 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 117 {
akashvibhute 0:30537dec6e0b 118 int offset = 0;
akashvibhute 0:30537dec6e0b 119 union {
akashvibhute 0:30537dec6e0b 120 bool real;
akashvibhute 0:30537dec6e0b 121 uint8_t base;
akashvibhute 0:30537dec6e0b 122 } u_success;
akashvibhute 0:30537dec6e0b 123 u_success.real = this->success;
akashvibhute 0:30537dec6e0b 124 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 125 offset += sizeof(this->success);
akashvibhute 0:30537dec6e0b 126 uint32_t length_status_message = strlen(this->status_message);
akashvibhute 0:30537dec6e0b 127 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 128 offset += 4;
akashvibhute 0:30537dec6e0b 129 memcpy(outbuffer + offset, this->status_message, length_status_message);
akashvibhute 0:30537dec6e0b 130 offset += length_status_message;
akashvibhute 0:30537dec6e0b 131 return offset;
akashvibhute 0:30537dec6e0b 132 }
akashvibhute 0:30537dec6e0b 133
akashvibhute 0:30537dec6e0b 134 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 135 {
akashvibhute 0:30537dec6e0b 136 int offset = 0;
akashvibhute 0:30537dec6e0b 137 union {
akashvibhute 0:30537dec6e0b 138 bool real;
akashvibhute 0:30537dec6e0b 139 uint8_t base;
akashvibhute 0:30537dec6e0b 140 } u_success;
akashvibhute 0:30537dec6e0b 141 u_success.base = 0;
akashvibhute 0:30537dec6e0b 142 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 143 this->success = u_success.real;
akashvibhute 0:30537dec6e0b 144 offset += sizeof(this->success);
akashvibhute 0:30537dec6e0b 145 uint32_t length_status_message;
akashvibhute 0:30537dec6e0b 146 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 147 offset += 4;
akashvibhute 0:30537dec6e0b 148 for(unsigned int k= offset; k< offset+length_status_message; ++k){
akashvibhute 0:30537dec6e0b 149 inbuffer[k-1]=inbuffer[k];
akashvibhute 0:30537dec6e0b 150 }
akashvibhute 0:30537dec6e0b 151 inbuffer[offset+length_status_message-1]=0;
akashvibhute 0:30537dec6e0b 152 this->status_message = (char *)(inbuffer + offset-1);
akashvibhute 0:30537dec6e0b 153 offset += length_status_message;
akashvibhute 0:30537dec6e0b 154 return offset;
akashvibhute 0:30537dec6e0b 155 }
akashvibhute 0:30537dec6e0b 156
akashvibhute 0:30537dec6e0b 157 const char * getType(){ return SETLINKPROPERTIES; };
akashvibhute 0:30537dec6e0b 158 const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; };
akashvibhute 0:30537dec6e0b 159
akashvibhute 0:30537dec6e0b 160 };
akashvibhute 0:30537dec6e0b 161
akashvibhute 0:30537dec6e0b 162 class SetLinkProperties {
akashvibhute 0:30537dec6e0b 163 public:
akashvibhute 0:30537dec6e0b 164 typedef SetLinkPropertiesRequest Request;
akashvibhute 0:30537dec6e0b 165 typedef SetLinkPropertiesResponse Response;
akashvibhute 0:30537dec6e0b 166 };
akashvibhute 0:30537dec6e0b 167
akashvibhute 0:30537dec6e0b 168 }
akashvibhute 0:30537dec6e0b 169 #endif
akashvibhute 0:30537dec6e0b 170