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_actionlib_msgs_GoalID_h
akashvibhute 0:30537dec6e0b 2 #define _ROS_actionlib_msgs_GoalID_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 "ros/time.h"
akashvibhute 0:30537dec6e0b 9
akashvibhute 0:30537dec6e0b 10 namespace actionlib_msgs
akashvibhute 0:30537dec6e0b 11 {
akashvibhute 0:30537dec6e0b 12
akashvibhute 0:30537dec6e0b 13 class GoalID : public ros::Msg
akashvibhute 0:30537dec6e0b 14 {
akashvibhute 0:30537dec6e0b 15 public:
akashvibhute 0:30537dec6e0b 16 ros::Time stamp;
akashvibhute 0:30537dec6e0b 17 const char* id;
akashvibhute 0:30537dec6e0b 18
akashvibhute 0:30537dec6e0b 19 GoalID():
akashvibhute 0:30537dec6e0b 20 stamp(),
akashvibhute 0:30537dec6e0b 21 id("")
akashvibhute 0:30537dec6e0b 22 {
akashvibhute 0:30537dec6e0b 23 }
akashvibhute 0:30537dec6e0b 24
akashvibhute 0:30537dec6e0b 25 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 26 {
akashvibhute 0:30537dec6e0b 27 int offset = 0;
akashvibhute 0:30537dec6e0b 28 *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 29 *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF;
akashvibhute 0:30537dec6e0b 30 *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF;
akashvibhute 0:30537dec6e0b 31 *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF;
akashvibhute 0:30537dec6e0b 32 offset += sizeof(this->stamp.sec);
akashvibhute 0:30537dec6e0b 33 *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF;
akashvibhute 0:30537dec6e0b 34 *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF;
akashvibhute 0:30537dec6e0b 35 *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF;
akashvibhute 0:30537dec6e0b 36 *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF;
akashvibhute 0:30537dec6e0b 37 offset += sizeof(this->stamp.nsec);
akashvibhute 0:30537dec6e0b 38 uint32_t length_id = strlen(this->id);
akashvibhute 0:30537dec6e0b 39 memcpy(outbuffer + offset, &length_id, sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 40 offset += 4;
akashvibhute 0:30537dec6e0b 41 memcpy(outbuffer + offset, this->id, length_id);
akashvibhute 0:30537dec6e0b 42 offset += length_id;
akashvibhute 0:30537dec6e0b 43 return offset;
akashvibhute 0:30537dec6e0b 44 }
akashvibhute 0:30537dec6e0b 45
akashvibhute 0:30537dec6e0b 46 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 47 {
akashvibhute 0:30537dec6e0b 48 int offset = 0;
akashvibhute 0:30537dec6e0b 49 this->stamp.sec = ((uint32_t) (*(inbuffer + offset)));
akashvibhute 0:30537dec6e0b 50 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
akashvibhute 0:30537dec6e0b 51 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
akashvibhute 0:30537dec6e0b 52 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
akashvibhute 0:30537dec6e0b 53 offset += sizeof(this->stamp.sec);
akashvibhute 0:30537dec6e0b 54 this->stamp.nsec = ((uint32_t) (*(inbuffer + offset)));
akashvibhute 0:30537dec6e0b 55 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
akashvibhute 0:30537dec6e0b 56 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
akashvibhute 0:30537dec6e0b 57 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
akashvibhute 0:30537dec6e0b 58 offset += sizeof(this->stamp.nsec);
akashvibhute 0:30537dec6e0b 59 uint32_t length_id;
akashvibhute 0:30537dec6e0b 60 memcpy(&length_id, (inbuffer + offset), sizeof(uint32_t));
akashvibhute 0:30537dec6e0b 61 offset += 4;
akashvibhute 0:30537dec6e0b 62 for(unsigned int k= offset; k< offset+length_id; ++k){
akashvibhute 0:30537dec6e0b 63 inbuffer[k-1]=inbuffer[k];
akashvibhute 0:30537dec6e0b 64 }
akashvibhute 0:30537dec6e0b 65 inbuffer[offset+length_id-1]=0;
akashvibhute 0:30537dec6e0b 66 this->id = (char *)(inbuffer + offset-1);
akashvibhute 0:30537dec6e0b 67 offset += length_id;
akashvibhute 0:30537dec6e0b 68 return offset;
akashvibhute 0:30537dec6e0b 69 }
akashvibhute 0:30537dec6e0b 70
akashvibhute 0:30537dec6e0b 71 const char * getType(){ return "actionlib_msgs/GoalID"; };
akashvibhute 0:30537dec6e0b 72 const char * getMD5(){ return "302881f31927c1df708a2dbab0e80ee8"; };
akashvibhute 0:30537dec6e0b 73
akashvibhute 0:30537dec6e0b 74 };
akashvibhute 0:30537dec6e0b 75
akashvibhute 0:30537dec6e0b 76 }
akashvibhute 0:30537dec6e0b 77 #endif