rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
actionlib_msgs/GoalStatus.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_actionlib_msgs_GoalStatus_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_actionlib_msgs_GoalStatus_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 "actionlib_msgs/GoalID.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 GoalStatus : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 14 | { |
akashvibhute | 0:30537dec6e0b | 15 | public: |
akashvibhute | 0:30537dec6e0b | 16 | actionlib_msgs::GoalID goal_id; |
akashvibhute | 0:30537dec6e0b | 17 | uint8_t status; |
akashvibhute | 0:30537dec6e0b | 18 | const char* text; |
akashvibhute | 0:30537dec6e0b | 19 | enum { PENDING = 0 }; |
akashvibhute | 0:30537dec6e0b | 20 | enum { ACTIVE = 1 }; |
akashvibhute | 0:30537dec6e0b | 21 | enum { PREEMPTED = 2 }; |
akashvibhute | 0:30537dec6e0b | 22 | enum { SUCCEEDED = 3 }; |
akashvibhute | 0:30537dec6e0b | 23 | enum { ABORTED = 4 }; |
akashvibhute | 0:30537dec6e0b | 24 | enum { REJECTED = 5 }; |
akashvibhute | 0:30537dec6e0b | 25 | enum { PREEMPTING = 6 }; |
akashvibhute | 0:30537dec6e0b | 26 | enum { RECALLING = 7 }; |
akashvibhute | 0:30537dec6e0b | 27 | enum { RECALLED = 8 }; |
akashvibhute | 0:30537dec6e0b | 28 | enum { LOST = 9 }; |
akashvibhute | 0:30537dec6e0b | 29 | |
akashvibhute | 0:30537dec6e0b | 30 | GoalStatus(): |
akashvibhute | 0:30537dec6e0b | 31 | goal_id(), |
akashvibhute | 0:30537dec6e0b | 32 | status(0), |
akashvibhute | 0:30537dec6e0b | 33 | text("") |
akashvibhute | 0:30537dec6e0b | 34 | { |
akashvibhute | 0:30537dec6e0b | 35 | } |
akashvibhute | 0:30537dec6e0b | 36 | |
akashvibhute | 0:30537dec6e0b | 37 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 38 | { |
akashvibhute | 0:30537dec6e0b | 39 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 40 | offset += this->goal_id.serialize(outbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 41 | *(outbuffer + offset + 0) = (this->status >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 42 | offset += sizeof(this->status); |
akashvibhute | 0:30537dec6e0b | 43 | uint32_t length_text = strlen(this->text); |
akashvibhute | 0:30537dec6e0b | 44 | memcpy(outbuffer + offset, &length_text, sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 45 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 46 | memcpy(outbuffer + offset, this->text, length_text); |
akashvibhute | 0:30537dec6e0b | 47 | offset += length_text; |
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 | offset += this->goal_id.deserialize(inbuffer + offset); |
akashvibhute | 0:30537dec6e0b | 55 | this->status = ((uint8_t) (*(inbuffer + offset))); |
akashvibhute | 0:30537dec6e0b | 56 | offset += sizeof(this->status); |
akashvibhute | 0:30537dec6e0b | 57 | uint32_t length_text; |
akashvibhute | 0:30537dec6e0b | 58 | memcpy(&length_text, (inbuffer + offset), sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 59 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 60 | for(unsigned int k= offset; k< offset+length_text; ++k){ |
akashvibhute | 0:30537dec6e0b | 61 | inbuffer[k-1]=inbuffer[k]; |
akashvibhute | 0:30537dec6e0b | 62 | } |
akashvibhute | 0:30537dec6e0b | 63 | inbuffer[offset+length_text-1]=0; |
akashvibhute | 0:30537dec6e0b | 64 | this->text = (char *)(inbuffer + offset-1); |
akashvibhute | 0:30537dec6e0b | 65 | offset += length_text; |
akashvibhute | 0:30537dec6e0b | 66 | return offset; |
akashvibhute | 0:30537dec6e0b | 67 | } |
akashvibhute | 0:30537dec6e0b | 68 | |
akashvibhute | 0:30537dec6e0b | 69 | const char * getType(){ return "actionlib_msgs/GoalStatus"; }; |
akashvibhute | 0:30537dec6e0b | 70 | const char * getMD5(){ return "d388f9b87b3c471f784434d671988d4a"; }; |
akashvibhute | 0:30537dec6e0b | 71 | |
akashvibhute | 0:30537dec6e0b | 72 | }; |
akashvibhute | 0:30537dec6e0b | 73 | |
akashvibhute | 0:30537dec6e0b | 74 | } |
akashvibhute | 0:30537dec6e0b | 75 | #endif |