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_moveit_msgs_ContactInformation_h
akashvibhute 0:30537dec6e0b 2 #define _ROS_moveit_msgs_ContactInformation_h
akashvibhute 0:30537dec6e0b 3
akashvibhute 0:30537dec6e0b 4 #include <stdint.h>
akashvibhute 0:30537dec6e0b 5 #include <string.h>
akashvibhute 0:30537dec6e0b 6 #include <stdlib.h>
akashvibhute 0:30537dec6e0b 7 #include "ros/msg.h"
akashvibhute 0:30537dec6e0b 8 #include "std_msgs/Header.h"
akashvibhute 0:30537dec6e0b 9 #include "geometry_msgs/Point.h"
akashvibhute 0:30537dec6e0b 10 #include "geometry_msgs/Vector3.h"
akashvibhute 0:30537dec6e0b 11
akashvibhute 0:30537dec6e0b 12 namespace moveit_msgs
akashvibhute 0:30537dec6e0b 13 {
akashvibhute 0:30537dec6e0b 14
akashvibhute 0:30537dec6e0b 15 class ContactInformation : public ros::Msg
akashvibhute 0:30537dec6e0b 16 {
akashvibhute 0:30537dec6e0b 17 public:
akashvibhute 0:30537dec6e0b 18 std_msgs::Header header;
akashvibhute 0:30537dec6e0b 19 geometry_msgs::Point position;
akashvibhute 0:30537dec6e0b 20 geometry_msgs::Vector3 normal;
akashvibhute 0:30537dec6e0b 21 float depth;
akashvibhute 0:30537dec6e0b 22 const char* contact_body_1;
akashvibhute 0:30537dec6e0b 23 uint32_t body_type_1;
akashvibhute 0:30537dec6e0b 24 const char* contact_body_2;
akashvibhute 0:30537dec6e0b 25 uint32_t body_type_2;
akashvibhute 0:30537dec6e0b 26 enum { ROBOT_LINK = 0 };
akashvibhute 0:30537dec6e0b 27 enum { WORLD_OBJECT = 1 };
akashvibhute 0:30537dec6e0b 28 enum { ROBOT_ATTACHED = 2 };
akashvibhute 0:30537dec6e0b 29
akashvibhute 0:30537dec6e0b 30 ContactInformation():
akashvibhute 0:30537dec6e0b 31 header(),
akashvibhute 0:30537dec6e0b 32 position(),
akashvibhute 0:30537dec6e0b 33 normal(),
akashvibhute 0:30537dec6e0b 34 depth(0),
akashvibhute 0:30537dec6e0b 35 contact_body_1(""),
akashvibhute 0:30537dec6e0b 36 body_type_1(0),
akashvibhute 0:30537dec6e0b 37 contact_body_2(""),
akashvibhute 0:30537dec6e0b 38 body_type_2(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 offset += this->header.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 46 offset += this->position.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 47 offset += this->normal.serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 48 offset += serializeAvrFloat64(outbuffer + offset, this->depth);
akashvibhute 0:30537dec6e0b 49 uint32_t length_contact_body_1 = strlen(this->contact_body_1);
akashvibhute 0:30537dec6e0b 50 memcpy(outbuffer + offset, &length_contact_body_1, sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 51 offset += 4;
akashvibhute 0:30537dec6e0b 52 memcpy(outbuffer + offset, this->contact_body_1, length_contact_body_1);
akashvibhute 0:30537dec6e0b 53 offset += length_contact_body_1;
akashvibhute 0:30537dec6e0b 54 *(outbuffer + offset + 0) = (this->body_type_1 >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 55 *(outbuffer + offset + 1) = (this->body_type_1 >> (8 * 1)) & 0xFF;
akashvibhute 0:30537dec6e0b 56 *(outbuffer + offset + 2) = (this->body_type_1 >> (8 * 2)) & 0xFF;
akashvibhute 0:30537dec6e0b 57 *(outbuffer + offset + 3) = (this->body_type_1 >> (8 * 3)) & 0xFF;
akashvibhute 0:30537dec6e0b 58 offset += sizeof(this->body_type_1);
akashvibhute 0:30537dec6e0b 59 uint32_t length_contact_body_2 = strlen(this->contact_body_2);
akashvibhute 0:30537dec6e0b 60 memcpy(outbuffer + offset, &length_contact_body_2, sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 61 offset += 4;
akashvibhute 0:30537dec6e0b 62 memcpy(outbuffer + offset, this->contact_body_2, length_contact_body_2);
akashvibhute 0:30537dec6e0b 63 offset += length_contact_body_2;
akashvibhute 0:30537dec6e0b 64 *(outbuffer + offset + 0) = (this->body_type_2 >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 65 *(outbuffer + offset + 1) = (this->body_type_2 >> (8 * 1)) & 0xFF;
akashvibhute 0:30537dec6e0b 66 *(outbuffer + offset + 2) = (this->body_type_2 >> (8 * 2)) & 0xFF;
akashvibhute 0:30537dec6e0b 67 *(outbuffer + offset + 3) = (this->body_type_2 >> (8 * 3)) & 0xFF;
akashvibhute 0:30537dec6e0b 68 offset += sizeof(this->body_type_2);
akashvibhute 0:30537dec6e0b 69 return offset;
akashvibhute 0:30537dec6e0b 70 }
akashvibhute 0:30537dec6e0b 71
akashvibhute 0:30537dec6e0b 72 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 73 {
akashvibhute 0:30537dec6e0b 74 int offset = 0;
akashvibhute 0:30537dec6e0b 75 offset += this->header.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 76 offset += this->position.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 77 offset += this->normal.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 78 offset += deserializeAvrFloat64(inbuffer + offset, &(this->depth));
akashvibhute 0:30537dec6e0b 79 uint32_t length_contact_body_1;
akashvibhute 0:30537dec6e0b 80 memcpy(&length_contact_body_1, (inbuffer + offset), sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 81 offset += 4;
akashvibhute 0:30537dec6e0b 82 for(unsigned int k= offset; k< offset+length_contact_body_1; ++k){
akashvibhute 0:30537dec6e0b 83 inbuffer[k-1]=inbuffer[k];
akashvibhute 0:30537dec6e0b 84 }
akashvibhute 0:30537dec6e0b 85 inbuffer[offset+length_contact_body_1-1]=0;
akashvibhute 0:30537dec6e0b 86 this->contact_body_1 = (char *)(inbuffer + offset-1);
akashvibhute 0:30537dec6e0b 87 offset += length_contact_body_1;
akashvibhute 0:30537dec6e0b 88 this->body_type_1 = ((uint32_t) (*(inbuffer + offset)));
akashvibhute 0:30537dec6e0b 89 this->body_type_1 |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
akashvibhute 0:30537dec6e0b 90 this->body_type_1 |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
akashvibhute 0:30537dec6e0b 91 this->body_type_1 |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
akashvibhute 0:30537dec6e0b 92 offset += sizeof(this->body_type_1);
akashvibhute 0:30537dec6e0b 93 uint32_t length_contact_body_2;
akashvibhute 0:30537dec6e0b 94 memcpy(&length_contact_body_2, (inbuffer + offset), sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 95 offset += 4;
akashvibhute 0:30537dec6e0b 96 for(unsigned int k= offset; k< offset+length_contact_body_2; ++k){
akashvibhute 0:30537dec6e0b 97 inbuffer[k-1]=inbuffer[k];
akashvibhute 0:30537dec6e0b 98 }
akashvibhute 0:30537dec6e0b 99 inbuffer[offset+length_contact_body_2-1]=0;
akashvibhute 0:30537dec6e0b 100 this->contact_body_2 = (char *)(inbuffer + offset-1);
akashvibhute 0:30537dec6e0b 101 offset += length_contact_body_2;
akashvibhute 0:30537dec6e0b 102 this->body_type_2 = ((uint32_t) (*(inbuffer + offset)));
akashvibhute 0:30537dec6e0b 103 this->body_type_2 |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
akashvibhute 0:30537dec6e0b 104 this->body_type_2 |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
akashvibhute 0:30537dec6e0b 105 this->body_type_2 |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
akashvibhute 0:30537dec6e0b 106 offset += sizeof(this->body_type_2);
akashvibhute 0:30537dec6e0b 107 return offset;
akashvibhute 0:30537dec6e0b 108 }
akashvibhute 0:30537dec6e0b 109
akashvibhute 0:30537dec6e0b 110 const char * getType(){ return "moveit_msgs/ContactInformation"; };
akashvibhute 0:30537dec6e0b 111 const char * getMD5(){ return "116228ca08b0c286ec5ca32a50fdc17b"; };
akashvibhute 0:30537dec6e0b 112
akashvibhute 0:30537dec6e0b 113 };
akashvibhute 0:30537dec6e0b 114
akashvibhute 0:30537dec6e0b 115 }
akashvibhute 0:30537dec6e0b 116 #endif