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_SetJointProperties_h
akashvibhute 0:30537dec6e0b 2 #define _ROS_SERVICE_SetJointProperties_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 "gazebo_msgs/ODEJointProperties.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 SETJOINTPROPERTIES[] = "gazebo_msgs/SetJointProperties";
akashvibhute 0:30537dec6e0b 13
akashvibhute 0:30537dec6e0b 14 class SetJointPropertiesRequest : public ros::Msg
akashvibhute 0:30537dec6e0b 15 {
akashvibhute 0:30537dec6e0b 16 public:
akashvibhute 0:30537dec6e0b 17 const char* joint_name;
akashvibhute 0:30537dec6e0b 18 gazebo_msgs::ODEJointProperties ode_joint_config;
akashvibhute 0:30537dec6e0b 19
akashvibhute 0:30537dec6e0b 20 SetJointPropertiesRequest():
akashvibhute 0:30537dec6e0b 21 joint_name(""),
akashvibhute 0:30537dec6e0b 22 ode_joint_config()
akashvibhute 0:30537dec6e0b 23 {
akashvibhute 0:30537dec6e0b 24 }
akashvibhute 0:30537dec6e0b 25
akashvibhute 0:30537dec6e0b 26 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 27 {
akashvibhute 0:30537dec6e0b 28 int offset = 0;
akashvibhute 0:30537dec6e0b 29 uint32_t length_joint_name = strlen(this->joint_name);
akashvibhute 0:30537dec6e0b 30 memcpy(outbuffer + offset, &length_joint_name, sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 31 offset += 4;
akashvibhute 0:30537dec6e0b 32 memcpy(outbuffer + offset, this->joint_name, length_joint_name);
akashvibhute 0:30537dec6e0b 33 offset += length_joint_name;
akashvibhute 0:30537dec6e0b 34 offset += this->ode_joint_config.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 35 return offset;
akashvibhute 0:30537dec6e0b 36 }
akashvibhute 0:30537dec6e0b 37
akashvibhute 0:30537dec6e0b 38 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 39 {
akashvibhute 0:30537dec6e0b 40 int offset = 0;
akashvibhute 0:30537dec6e0b 41 uint32_t length_joint_name;
akashvibhute 0:30537dec6e0b 42 memcpy(&length_joint_name, (inbuffer + offset), sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 43 offset += 4;
akashvibhute 0:30537dec6e0b 44 for(unsigned int k= offset; k< offset+length_joint_name; ++k){
akashvibhute 0:30537dec6e0b 45 inbuffer[k-1]=inbuffer[k];
akashvibhute 0:30537dec6e0b 46 }
akashvibhute 0:30537dec6e0b 47 inbuffer[offset+length_joint_name-1]=0;
akashvibhute 0:30537dec6e0b 48 this->joint_name = (char *)(inbuffer + offset-1);
akashvibhute 0:30537dec6e0b 49 offset += length_joint_name;
akashvibhute 0:30537dec6e0b 50 offset += this->ode_joint_config.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 51 return offset;
akashvibhute 0:30537dec6e0b 52 }
akashvibhute 0:30537dec6e0b 53
akashvibhute 0:30537dec6e0b 54 const char * getType(){ return SETJOINTPROPERTIES; };
akashvibhute 0:30537dec6e0b 55 const char * getMD5(){ return "331fd8f35fd27e3c1421175590258e26"; };
akashvibhute 0:30537dec6e0b 56
akashvibhute 0:30537dec6e0b 57 };
akashvibhute 0:30537dec6e0b 58
akashvibhute 0:30537dec6e0b 59 class SetJointPropertiesResponse : public ros::Msg
akashvibhute 0:30537dec6e0b 60 {
akashvibhute 0:30537dec6e0b 61 public:
akashvibhute 0:30537dec6e0b 62 bool success;
akashvibhute 0:30537dec6e0b 63 const char* status_message;
akashvibhute 0:30537dec6e0b 64
akashvibhute 0:30537dec6e0b 65 SetJointPropertiesResponse():
akashvibhute 0:30537dec6e0b 66 success(0),
akashvibhute 0:30537dec6e0b 67 status_message("")
akashvibhute 0:30537dec6e0b 68 {
akashvibhute 0:30537dec6e0b 69 }
akashvibhute 0:30537dec6e0b 70
akashvibhute 0:30537dec6e0b 71 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 72 {
akashvibhute 0:30537dec6e0b 73 int offset = 0;
akashvibhute 0:30537dec6e0b 74 union {
akashvibhute 0:30537dec6e0b 75 bool real;
akashvibhute 0:30537dec6e0b 76 uint8_t base;
akashvibhute 0:30537dec6e0b 77 } u_success;
akashvibhute 0:30537dec6e0b 78 u_success.real = this->success;
akashvibhute 0:30537dec6e0b 79 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 80 offset += sizeof(this->success);
akashvibhute 0:30537dec6e0b 81 uint32_t length_status_message = strlen(this->status_message);
akashvibhute 0:30537dec6e0b 82 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 83 offset += 4;
akashvibhute 0:30537dec6e0b 84 memcpy(outbuffer + offset, this->status_message, length_status_message);
akashvibhute 0:30537dec6e0b 85 offset += length_status_message;
akashvibhute 0:30537dec6e0b 86 return offset;
akashvibhute 0:30537dec6e0b 87 }
akashvibhute 0:30537dec6e0b 88
akashvibhute 0:30537dec6e0b 89 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 90 {
akashvibhute 0:30537dec6e0b 91 int offset = 0;
akashvibhute 0:30537dec6e0b 92 union {
akashvibhute 0:30537dec6e0b 93 bool real;
akashvibhute 0:30537dec6e0b 94 uint8_t base;
akashvibhute 0:30537dec6e0b 95 } u_success;
akashvibhute 0:30537dec6e0b 96 u_success.base = 0;
akashvibhute 0:30537dec6e0b 97 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
akashvibhute 0:30537dec6e0b 98 this->success = u_success.real;
akashvibhute 0:30537dec6e0b 99 offset += sizeof(this->success);
akashvibhute 0:30537dec6e0b 100 uint32_t length_status_message;
akashvibhute 0:30537dec6e0b 101 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 102 offset += 4;
akashvibhute 0:30537dec6e0b 103 for(unsigned int k= offset; k< offset+length_status_message; ++k){
akashvibhute 0:30537dec6e0b 104 inbuffer[k-1]=inbuffer[k];
akashvibhute 0:30537dec6e0b 105 }
akashvibhute 0:30537dec6e0b 106 inbuffer[offset+length_status_message-1]=0;
akashvibhute 0:30537dec6e0b 107 this->status_message = (char *)(inbuffer + offset-1);
akashvibhute 0:30537dec6e0b 108 offset += length_status_message;
akashvibhute 0:30537dec6e0b 109 return offset;
akashvibhute 0:30537dec6e0b 110 }
akashvibhute 0:30537dec6e0b 111
akashvibhute 0:30537dec6e0b 112 const char * getType(){ return SETJOINTPROPERTIES; };
akashvibhute 0:30537dec6e0b 113 const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; };
akashvibhute 0:30537dec6e0b 114
akashvibhute 0:30537dec6e0b 115 };
akashvibhute 0:30537dec6e0b 116
akashvibhute 0:30537dec6e0b 117 class SetJointProperties {
akashvibhute 0:30537dec6e0b 118 public:
akashvibhute 0:30537dec6e0b 119 typedef SetJointPropertiesRequest Request;
akashvibhute 0:30537dec6e0b 120 typedef SetJointPropertiesResponse Response;
akashvibhute 0:30537dec6e0b 121 };
akashvibhute 0:30537dec6e0b 122
akashvibhute 0:30537dec6e0b 123 }
akashvibhute 0:30537dec6e0b 124 #endif
akashvibhute 0:30537dec6e0b 125