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