rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
map_msgs/ProjectedMapInfo.h@0:30537dec6e0b, 2015-02-15 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:30537dec6e0b | 1 | #ifndef _ROS_map_msgs_ProjectedMapInfo_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_map_msgs_ProjectedMapInfo_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 | |
akashvibhute | 0:30537dec6e0b | 9 | namespace map_msgs |
akashvibhute | 0:30537dec6e0b | 10 | { |
akashvibhute | 0:30537dec6e0b | 11 | |
akashvibhute | 0:30537dec6e0b | 12 | class ProjectedMapInfo : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 13 | { |
akashvibhute | 0:30537dec6e0b | 14 | public: |
akashvibhute | 0:30537dec6e0b | 15 | const char* frame_id; |
akashvibhute | 0:30537dec6e0b | 16 | float x; |
akashvibhute | 0:30537dec6e0b | 17 | float y; |
akashvibhute | 0:30537dec6e0b | 18 | float width; |
akashvibhute | 0:30537dec6e0b | 19 | float height; |
akashvibhute | 0:30537dec6e0b | 20 | float min_z; |
akashvibhute | 0:30537dec6e0b | 21 | float max_z; |
akashvibhute | 0:30537dec6e0b | 22 | |
akashvibhute | 0:30537dec6e0b | 23 | ProjectedMapInfo(): |
akashvibhute | 0:30537dec6e0b | 24 | frame_id(""), |
akashvibhute | 0:30537dec6e0b | 25 | x(0), |
akashvibhute | 0:30537dec6e0b | 26 | y(0), |
akashvibhute | 0:30537dec6e0b | 27 | width(0), |
akashvibhute | 0:30537dec6e0b | 28 | height(0), |
akashvibhute | 0:30537dec6e0b | 29 | min_z(0), |
akashvibhute | 0:30537dec6e0b | 30 | max_z(0) |
akashvibhute | 0:30537dec6e0b | 31 | { |
akashvibhute | 0:30537dec6e0b | 32 | } |
akashvibhute | 0:30537dec6e0b | 33 | |
akashvibhute | 0:30537dec6e0b | 34 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 35 | { |
akashvibhute | 0:30537dec6e0b | 36 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 37 | uint32_t length_frame_id = strlen(this->frame_id); |
akashvibhute | 0:30537dec6e0b | 38 | memcpy(outbuffer + offset, &length_frame_id, sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 39 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 40 | memcpy(outbuffer + offset, this->frame_id, length_frame_id); |
akashvibhute | 0:30537dec6e0b | 41 | offset += length_frame_id; |
akashvibhute | 0:30537dec6e0b | 42 | offset += serializeAvrFloat64(outbuffer + offset, this->x); |
akashvibhute | 0:30537dec6e0b | 43 | offset += serializeAvrFloat64(outbuffer + offset, this->y); |
akashvibhute | 0:30537dec6e0b | 44 | offset += serializeAvrFloat64(outbuffer + offset, this->width); |
akashvibhute | 0:30537dec6e0b | 45 | offset += serializeAvrFloat64(outbuffer + offset, this->height); |
akashvibhute | 0:30537dec6e0b | 46 | offset += serializeAvrFloat64(outbuffer + offset, this->min_z); |
akashvibhute | 0:30537dec6e0b | 47 | offset += serializeAvrFloat64(outbuffer + offset, this->max_z); |
akashvibhute | 0:30537dec6e0b | 48 | return offset; |
akashvibhute | 0:30537dec6e0b | 49 | } |
akashvibhute | 0:30537dec6e0b | 50 | |
akashvibhute | 0:30537dec6e0b | 51 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 52 | { |
akashvibhute | 0:30537dec6e0b | 53 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 54 | uint32_t length_frame_id; |
akashvibhute | 0:30537dec6e0b | 55 | memcpy(&length_frame_id, (inbuffer + offset), sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 56 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 57 | for(unsigned int k= offset; k< offset+length_frame_id; ++k){ |
akashvibhute | 0:30537dec6e0b | 58 | inbuffer[k-1]=inbuffer[k]; |
akashvibhute | 0:30537dec6e0b | 59 | } |
akashvibhute | 0:30537dec6e0b | 60 | inbuffer[offset+length_frame_id-1]=0; |
akashvibhute | 0:30537dec6e0b | 61 | this->frame_id = (char *)(inbuffer + offset-1); |
akashvibhute | 0:30537dec6e0b | 62 | offset += length_frame_id; |
akashvibhute | 0:30537dec6e0b | 63 | offset += deserializeAvrFloat64(inbuffer + offset, &(this->x)); |
akashvibhute | 0:30537dec6e0b | 64 | offset += deserializeAvrFloat64(inbuffer + offset, &(this->y)); |
akashvibhute | 0:30537dec6e0b | 65 | offset += deserializeAvrFloat64(inbuffer + offset, &(this->width)); |
akashvibhute | 0:30537dec6e0b | 66 | offset += deserializeAvrFloat64(inbuffer + offset, &(this->height)); |
akashvibhute | 0:30537dec6e0b | 67 | offset += deserializeAvrFloat64(inbuffer + offset, &(this->min_z)); |
akashvibhute | 0:30537dec6e0b | 68 | offset += deserializeAvrFloat64(inbuffer + offset, &(this->max_z)); |
akashvibhute | 0:30537dec6e0b | 69 | return offset; |
akashvibhute | 0:30537dec6e0b | 70 | } |
akashvibhute | 0:30537dec6e0b | 71 | |
akashvibhute | 0:30537dec6e0b | 72 | const char * getType(){ return "map_msgs/ProjectedMapInfo"; }; |
akashvibhute | 0:30537dec6e0b | 73 | const char * getMD5(){ return "2dc10595ae94de23f22f8a6d2a0eef7a"; }; |
akashvibhute | 0:30537dec6e0b | 74 | |
akashvibhute | 0:30537dec6e0b | 75 | }; |
akashvibhute | 0:30537dec6e0b | 76 | |
akashvibhute | 0:30537dec6e0b | 77 | } |
akashvibhute | 0:30537dec6e0b | 78 | #endif |