hairo

Dependencies:   mbed BufferedSerial

Committer:
tknara
Date:
Tue Dec 04 00:14:32 2018 +0000
Revision:
4:bcdd99711326
Parent:
0:9e9b7db60fd5
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_control_msgs_GripperCommandFeedback_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_control_msgs_GripperCommandFeedback_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8
garyservin 0:9e9b7db60fd5 9 namespace control_msgs
garyservin 0:9e9b7db60fd5 10 {
garyservin 0:9e9b7db60fd5 11
garyservin 0:9e9b7db60fd5 12 class GripperCommandFeedback : public ros::Msg
garyservin 0:9e9b7db60fd5 13 {
garyservin 0:9e9b7db60fd5 14 public:
garyservin 0:9e9b7db60fd5 15 typedef double _position_type;
garyservin 0:9e9b7db60fd5 16 _position_type position;
garyservin 0:9e9b7db60fd5 17 typedef double _effort_type;
garyservin 0:9e9b7db60fd5 18 _effort_type effort;
garyservin 0:9e9b7db60fd5 19 typedef bool _stalled_type;
garyservin 0:9e9b7db60fd5 20 _stalled_type stalled;
garyservin 0:9e9b7db60fd5 21 typedef bool _reached_goal_type;
garyservin 0:9e9b7db60fd5 22 _reached_goal_type reached_goal;
garyservin 0:9e9b7db60fd5 23
garyservin 0:9e9b7db60fd5 24 GripperCommandFeedback():
garyservin 0:9e9b7db60fd5 25 position(0),
garyservin 0:9e9b7db60fd5 26 effort(0),
garyservin 0:9e9b7db60fd5 27 stalled(0),
garyservin 0:9e9b7db60fd5 28 reached_goal(0)
garyservin 0:9e9b7db60fd5 29 {
garyservin 0:9e9b7db60fd5 30 }
garyservin 0:9e9b7db60fd5 31
garyservin 0:9e9b7db60fd5 32 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 33 {
garyservin 0:9e9b7db60fd5 34 int offset = 0;
garyservin 0:9e9b7db60fd5 35 union {
garyservin 0:9e9b7db60fd5 36 double real;
garyservin 0:9e9b7db60fd5 37 uint64_t base;
garyservin 0:9e9b7db60fd5 38 } u_position;
garyservin 0:9e9b7db60fd5 39 u_position.real = this->position;
garyservin 0:9e9b7db60fd5 40 *(outbuffer + offset + 0) = (u_position.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 41 *(outbuffer + offset + 1) = (u_position.base >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 42 *(outbuffer + offset + 2) = (u_position.base >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 43 *(outbuffer + offset + 3) = (u_position.base >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 44 *(outbuffer + offset + 4) = (u_position.base >> (8 * 4)) & 0xFF;
garyservin 0:9e9b7db60fd5 45 *(outbuffer + offset + 5) = (u_position.base >> (8 * 5)) & 0xFF;
garyservin 0:9e9b7db60fd5 46 *(outbuffer + offset + 6) = (u_position.base >> (8 * 6)) & 0xFF;
garyservin 0:9e9b7db60fd5 47 *(outbuffer + offset + 7) = (u_position.base >> (8 * 7)) & 0xFF;
garyservin 0:9e9b7db60fd5 48 offset += sizeof(this->position);
garyservin 0:9e9b7db60fd5 49 union {
garyservin 0:9e9b7db60fd5 50 double real;
garyservin 0:9e9b7db60fd5 51 uint64_t base;
garyservin 0:9e9b7db60fd5 52 } u_effort;
garyservin 0:9e9b7db60fd5 53 u_effort.real = this->effort;
garyservin 0:9e9b7db60fd5 54 *(outbuffer + offset + 0) = (u_effort.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 55 *(outbuffer + offset + 1) = (u_effort.base >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 56 *(outbuffer + offset + 2) = (u_effort.base >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 57 *(outbuffer + offset + 3) = (u_effort.base >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 58 *(outbuffer + offset + 4) = (u_effort.base >> (8 * 4)) & 0xFF;
garyservin 0:9e9b7db60fd5 59 *(outbuffer + offset + 5) = (u_effort.base >> (8 * 5)) & 0xFF;
garyservin 0:9e9b7db60fd5 60 *(outbuffer + offset + 6) = (u_effort.base >> (8 * 6)) & 0xFF;
garyservin 0:9e9b7db60fd5 61 *(outbuffer + offset + 7) = (u_effort.base >> (8 * 7)) & 0xFF;
garyservin 0:9e9b7db60fd5 62 offset += sizeof(this->effort);
garyservin 0:9e9b7db60fd5 63 union {
garyservin 0:9e9b7db60fd5 64 bool real;
garyservin 0:9e9b7db60fd5 65 uint8_t base;
garyservin 0:9e9b7db60fd5 66 } u_stalled;
garyservin 0:9e9b7db60fd5 67 u_stalled.real = this->stalled;
garyservin 0:9e9b7db60fd5 68 *(outbuffer + offset + 0) = (u_stalled.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 69 offset += sizeof(this->stalled);
garyservin 0:9e9b7db60fd5 70 union {
garyservin 0:9e9b7db60fd5 71 bool real;
garyservin 0:9e9b7db60fd5 72 uint8_t base;
garyservin 0:9e9b7db60fd5 73 } u_reached_goal;
garyservin 0:9e9b7db60fd5 74 u_reached_goal.real = this->reached_goal;
garyservin 0:9e9b7db60fd5 75 *(outbuffer + offset + 0) = (u_reached_goal.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 76 offset += sizeof(this->reached_goal);
garyservin 0:9e9b7db60fd5 77 return offset;
garyservin 0:9e9b7db60fd5 78 }
garyservin 0:9e9b7db60fd5 79
garyservin 0:9e9b7db60fd5 80 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 81 {
garyservin 0:9e9b7db60fd5 82 int offset = 0;
garyservin 0:9e9b7db60fd5 83 union {
garyservin 0:9e9b7db60fd5 84 double real;
garyservin 0:9e9b7db60fd5 85 uint64_t base;
garyservin 0:9e9b7db60fd5 86 } u_position;
garyservin 0:9e9b7db60fd5 87 u_position.base = 0;
garyservin 0:9e9b7db60fd5 88 u_position.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 89 u_position.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 90 u_position.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 91 u_position.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 92 u_position.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:9e9b7db60fd5 93 u_position.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:9e9b7db60fd5 94 u_position.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:9e9b7db60fd5 95 u_position.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:9e9b7db60fd5 96 this->position = u_position.real;
garyservin 0:9e9b7db60fd5 97 offset += sizeof(this->position);
garyservin 0:9e9b7db60fd5 98 union {
garyservin 0:9e9b7db60fd5 99 double real;
garyservin 0:9e9b7db60fd5 100 uint64_t base;
garyservin 0:9e9b7db60fd5 101 } u_effort;
garyservin 0:9e9b7db60fd5 102 u_effort.base = 0;
garyservin 0:9e9b7db60fd5 103 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 104 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 105 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 106 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 107 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4);
garyservin 0:9e9b7db60fd5 108 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5);
garyservin 0:9e9b7db60fd5 109 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6);
garyservin 0:9e9b7db60fd5 110 u_effort.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7);
garyservin 0:9e9b7db60fd5 111 this->effort = u_effort.real;
garyservin 0:9e9b7db60fd5 112 offset += sizeof(this->effort);
garyservin 0:9e9b7db60fd5 113 union {
garyservin 0:9e9b7db60fd5 114 bool real;
garyservin 0:9e9b7db60fd5 115 uint8_t base;
garyservin 0:9e9b7db60fd5 116 } u_stalled;
garyservin 0:9e9b7db60fd5 117 u_stalled.base = 0;
garyservin 0:9e9b7db60fd5 118 u_stalled.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 119 this->stalled = u_stalled.real;
garyservin 0:9e9b7db60fd5 120 offset += sizeof(this->stalled);
garyservin 0:9e9b7db60fd5 121 union {
garyservin 0:9e9b7db60fd5 122 bool real;
garyservin 0:9e9b7db60fd5 123 uint8_t base;
garyservin 0:9e9b7db60fd5 124 } u_reached_goal;
garyservin 0:9e9b7db60fd5 125 u_reached_goal.base = 0;
garyservin 0:9e9b7db60fd5 126 u_reached_goal.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 127 this->reached_goal = u_reached_goal.real;
garyservin 0:9e9b7db60fd5 128 offset += sizeof(this->reached_goal);
garyservin 0:9e9b7db60fd5 129 return offset;
garyservin 0:9e9b7db60fd5 130 }
garyservin 0:9e9b7db60fd5 131
garyservin 0:9e9b7db60fd5 132 const char * getType(){ return "control_msgs/GripperCommandFeedback"; };
garyservin 0:9e9b7db60fd5 133 const char * getMD5(){ return "e4cbff56d3562bcf113da5a5adeef91f"; };
garyservin 0:9e9b7db60fd5 134
garyservin 0:9e9b7db60fd5 135 };
garyservin 0:9e9b7db60fd5 136
garyservin 0:9e9b7db60fd5 137 }
garyservin 0:9e9b7db60fd5 138 #endif