rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
laser_assembler/AssembleScans2.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_SERVICE_AssembleScans2_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_SERVICE_AssembleScans2_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 "sensor_msgs/PointCloud2.h" |
akashvibhute | 0:30537dec6e0b | 8 | #include "ros/time.h" |
akashvibhute | 0:30537dec6e0b | 9 | |
akashvibhute | 0:30537dec6e0b | 10 | namespace laser_assembler |
akashvibhute | 0:30537dec6e0b | 11 | { |
akashvibhute | 0:30537dec6e0b | 12 | |
akashvibhute | 0:30537dec6e0b | 13 | static const char ASSEMBLESCANS2[] = "laser_assembler/AssembleScans2"; |
akashvibhute | 0:30537dec6e0b | 14 | |
akashvibhute | 0:30537dec6e0b | 15 | class AssembleScans2Request : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 16 | { |
akashvibhute | 0:30537dec6e0b | 17 | public: |
akashvibhute | 0:30537dec6e0b | 18 | ros::Time begin; |
akashvibhute | 0:30537dec6e0b | 19 | ros::Time end; |
akashvibhute | 0:30537dec6e0b | 20 | |
akashvibhute | 0:30537dec6e0b | 21 | AssembleScans2Request(): |
akashvibhute | 0:30537dec6e0b | 22 | begin(), |
akashvibhute | 0:30537dec6e0b | 23 | end() |
akashvibhute | 0:30537dec6e0b | 24 | { |
akashvibhute | 0:30537dec6e0b | 25 | } |
akashvibhute | 0:30537dec6e0b | 26 | |
akashvibhute | 0:30537dec6e0b | 27 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 28 | { |
akashvibhute | 0:30537dec6e0b | 29 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 30 | *(outbuffer + offset + 0) = (this->begin.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 31 | *(outbuffer + offset + 1) = (this->begin.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 32 | *(outbuffer + offset + 2) = (this->begin.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 33 | *(outbuffer + offset + 3) = (this->begin.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 34 | offset += sizeof(this->begin.sec); |
akashvibhute | 0:30537dec6e0b | 35 | *(outbuffer + offset + 0) = (this->begin.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 36 | *(outbuffer + offset + 1) = (this->begin.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 37 | *(outbuffer + offset + 2) = (this->begin.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 38 | *(outbuffer + offset + 3) = (this->begin.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 39 | offset += sizeof(this->begin.nsec); |
akashvibhute | 0:30537dec6e0b | 40 | *(outbuffer + offset + 0) = (this->end.sec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 41 | *(outbuffer + offset + 1) = (this->end.sec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 42 | *(outbuffer + offset + 2) = (this->end.sec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 43 | *(outbuffer + offset + 3) = (this->end.sec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 44 | offset += sizeof(this->end.sec); |
akashvibhute | 0:30537dec6e0b | 45 | *(outbuffer + offset + 0) = (this->end.nsec >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 46 | *(outbuffer + offset + 1) = (this->end.nsec >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 47 | *(outbuffer + offset + 2) = (this->end.nsec >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 48 | *(outbuffer + offset + 3) = (this->end.nsec >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 49 | offset += sizeof(this->end.nsec); |
akashvibhute | 0:30537dec6e0b | 50 | return offset; |
akashvibhute | 0:30537dec6e0b | 51 | } |
akashvibhute | 0:30537dec6e0b | 52 | |
akashvibhute | 0:30537dec6e0b | 53 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 54 | { |
akashvibhute | 0:30537dec6e0b | 55 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 56 | this->begin.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 57 | this->begin.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 58 | this->begin.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 59 | this->begin.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 60 | offset += sizeof(this->begin.sec); |
akashvibhute | 0:30537dec6e0b | 61 | this->begin.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 62 | this->begin.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 63 | this->begin.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 64 | this->begin.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 65 | offset += sizeof(this->begin.nsec); |
akashvibhute | 0:30537dec6e0b | 66 | this->end.sec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 67 | this->end.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 68 | this->end.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 69 | this->end.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 70 | offset += sizeof(this->end.sec); |
akashvibhute | 0:30537dec6e0b | 71 | this->end.nsec = ((uint32_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 72 | this->end.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 73 | this->end.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 74 | this->end.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 75 | offset += sizeof(this->end.nsec); |
akashvibhute | 0:30537dec6e0b | 76 | return offset; |
akashvibhute | 0:30537dec6e0b | 77 | } |
akashvibhute | 0:30537dec6e0b | 78 | |
akashvibhute | 0:30537dec6e0b | 79 | const char * getType(){ return ASSEMBLESCANS2; }; |
akashvibhute | 0:30537dec6e0b | 80 | const char * getMD5(){ return "b341004f74e15bf5e1b2053a9183bdc7"; }; |
akashvibhute | 0:30537dec6e0b | 81 | |
akashvibhute | 0:30537dec6e0b | 82 | }; |
akashvibhute | 0:30537dec6e0b | 83 | |
akashvibhute | 0:30537dec6e0b | 84 | class AssembleScans2Response : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 85 | { |
akashvibhute | 0:30537dec6e0b | 86 | public: |
akashvibhute | 0:30537dec6e0b | 87 | sensor_msgs::PointCloud2 cloud; |
akashvibhute | 0:30537dec6e0b | 88 | |
akashvibhute | 0:30537dec6e0b | 89 | AssembleScans2Response(): |
akashvibhute | 0:30537dec6e0b | 90 | cloud() |
akashvibhute | 0:30537dec6e0b | 91 | { |
akashvibhute | 0:30537dec6e0b | 92 | } |
akashvibhute | 0:30537dec6e0b | 93 | |
akashvibhute | 0:30537dec6e0b | 94 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 95 | { |
akashvibhute | 0:30537dec6e0b | 96 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 97 | offset += this->cloud.serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 98 | return offset; |
akashvibhute | 0:30537dec6e0b | 99 | } |
akashvibhute | 0:30537dec6e0b | 100 | |
akashvibhute | 0:30537dec6e0b | 101 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 102 | { |
akashvibhute | 0:30537dec6e0b | 103 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 104 | offset += this->cloud.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 105 | return offset; |
akashvibhute | 0:30537dec6e0b | 106 | } |
akashvibhute | 0:30537dec6e0b | 107 | |
akashvibhute | 0:30537dec6e0b | 108 | const char * getType(){ return ASSEMBLESCANS2; }; |
akashvibhute | 0:30537dec6e0b | 109 | const char * getMD5(){ return "96cec5374164b3b3d1d7ef5d7628a7ed"; }; |
akashvibhute | 0:30537dec6e0b | 110 | |
akashvibhute | 0:30537dec6e0b | 111 | }; |
akashvibhute | 0:30537dec6e0b | 112 | |
akashvibhute | 0:30537dec6e0b | 113 | class AssembleScans2 { |
akashvibhute | 0:30537dec6e0b | 114 | public: |
akashvibhute | 0:30537dec6e0b | 115 | typedef AssembleScans2Request Request; |
akashvibhute | 0:30537dec6e0b | 116 | typedef AssembleScans2Response Response; |
akashvibhute | 0:30537dec6e0b | 117 | }; |
akashvibhute | 0:30537dec6e0b | 118 | |
akashvibhute | 0:30537dec6e0b | 119 | } |
akashvibhute | 0:30537dec6e0b | 120 | #endif |
akashvibhute | 0:30537dec6e0b | 121 |