rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
control_msgs/GripperCommandFeedback.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_control_msgs_GripperCommandFeedback_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_control_msgs_GripperCommandFeedback_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 control_msgs |
akashvibhute | 0:30537dec6e0b | 10 | { |
akashvibhute | 0:30537dec6e0b | 11 | |
akashvibhute | 0:30537dec6e0b | 12 | class GripperCommandFeedback : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 13 | { |
akashvibhute | 0:30537dec6e0b | 14 | public: |
akashvibhute | 0:30537dec6e0b | 15 | float position; |
akashvibhute | 0:30537dec6e0b | 16 | float effort; |
akashvibhute | 0:30537dec6e0b | 17 | bool stalled; |
akashvibhute | 0:30537dec6e0b | 18 | bool reached_goal; |
akashvibhute | 0:30537dec6e0b | 19 | |
akashvibhute | 0:30537dec6e0b | 20 | GripperCommandFeedback(): |
akashvibhute | 0:30537dec6e0b | 21 | position(0), |
akashvibhute | 0:30537dec6e0b | 22 | effort(0), |
akashvibhute | 0:30537dec6e0b | 23 | stalled(0), |
akashvibhute | 0:30537dec6e0b | 24 | reached_goal(0) |
akashvibhute | 0:30537dec6e0b | 25 | { |
akashvibhute | 0:30537dec6e0b | 26 | } |
akashvibhute | 0:30537dec6e0b | 27 | |
akashvibhute | 0:30537dec6e0b | 28 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 29 | { |
akashvibhute | 0:30537dec6e0b | 30 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 31 | offset += serializeAvrFloat64(outbuffer + offset, this->position); |
akashvibhute | 0:30537dec6e0b | 32 | offset += serializeAvrFloat64(outbuffer + offset, this->effort); |
akashvibhute | 0:30537dec6e0b | 33 | union { |
akashvibhute | 0:30537dec6e0b | 34 | bool real; |
akashvibhute | 0:30537dec6e0b | 35 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 36 | } u_stalled; |
akashvibhute | 0:30537dec6e0b | 37 | u_stalled.real = this->stalled; |
akashvibhute | 0:30537dec6e0b | 38 | *(outbuffer + offset + 0) = (u_stalled.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 39 | offset += sizeof(this->stalled); |
akashvibhute | 0:30537dec6e0b | 40 | union { |
akashvibhute | 0:30537dec6e0b | 41 | bool real; |
akashvibhute | 0:30537dec6e0b | 42 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 43 | } u_reached_goal; |
akashvibhute | 0:30537dec6e0b | 44 | u_reached_goal.real = this->reached_goal; |
akashvibhute | 0:30537dec6e0b | 45 | *(outbuffer + offset + 0) = (u_reached_goal.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 46 | offset += sizeof(this->reached_goal); |
akashvibhute | 0:30537dec6e0b | 47 | return offset; |
akashvibhute | 0:30537dec6e0b | 48 | } |
akashvibhute | 0:30537dec6e0b | 49 | |
akashvibhute | 0:30537dec6e0b | 50 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 51 | { |
akashvibhute | 0:30537dec6e0b | 52 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 53 | offset += deserializeAvrFloat64(inbuffer + offset, &(this->position)); |
akashvibhute | 0:30537dec6e0b | 54 | offset += deserializeAvrFloat64(inbuffer + offset, &(this->effort)); |
akashvibhute | 0:30537dec6e0b | 55 | union { |
akashvibhute | 0:30537dec6e0b | 56 | bool real; |
akashvibhute | 0:30537dec6e0b | 57 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 58 | } u_stalled; |
akashvibhute | 0:30537dec6e0b | 59 | u_stalled.base = 0; |
akashvibhute | 0:30537dec6e0b | 60 | u_stalled.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 61 | this->stalled = u_stalled.real; |
akashvibhute | 0:30537dec6e0b | 62 | offset += sizeof(this->stalled); |
akashvibhute | 0:30537dec6e0b | 63 | union { |
akashvibhute | 0:30537dec6e0b | 64 | bool real; |
akashvibhute | 0:30537dec6e0b | 65 | uint8_t base; |
akashvibhute | 0:30537dec6e0b | 66 | } u_reached_goal; |
akashvibhute | 0:30537dec6e0b | 67 | u_reached_goal.base = 0; |
akashvibhute | 0:30537dec6e0b | 68 | u_reached_goal.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 69 | this->reached_goal = u_reached_goal.real; |
akashvibhute | 0:30537dec6e0b | 70 | offset += sizeof(this->reached_goal); |
akashvibhute | 0:30537dec6e0b | 71 | return offset; |
akashvibhute | 0:30537dec6e0b | 72 | } |
akashvibhute | 0:30537dec6e0b | 73 | |
akashvibhute | 0:30537dec6e0b | 74 | const char * getType(){ return "control_msgs/GripperCommandFeedback"; }; |
akashvibhute | 0:30537dec6e0b | 75 | const char * getMD5(){ return "e4cbff56d3562bcf113da5a5adeef91f"; }; |
akashvibhute | 0:30537dec6e0b | 76 | |
akashvibhute | 0:30537dec6e0b | 77 | }; |
akashvibhute | 0:30537dec6e0b | 78 | |
akashvibhute | 0:30537dec6e0b | 79 | } |
akashvibhute | 0:30537dec6e0b | 80 | #endif |