hairo

Dependencies:   mbed BufferedSerial

Committer:
garyservin
Date:
Sat Dec 31 00:48:34 2016 +0000
Revision:
0:9e9b7db60fd5
Initial commit, generated based on a clean kinetic-desktop-full

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_SERVICE_ApplyBodyWrench_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_SERVICE_ApplyBodyWrench_h
garyservin 0:9e9b7db60fd5 3 #include <stdint.h>
garyservin 0:9e9b7db60fd5 4 #include <string.h>
garyservin 0:9e9b7db60fd5 5 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 6 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 7 #include "ros/duration.h"
garyservin 0:9e9b7db60fd5 8 #include "geometry_msgs/Wrench.h"
garyservin 0:9e9b7db60fd5 9 #include "ros/time.h"
garyservin 0:9e9b7db60fd5 10 #include "geometry_msgs/Point.h"
garyservin 0:9e9b7db60fd5 11
garyservin 0:9e9b7db60fd5 12 namespace gazebo_msgs
garyservin 0:9e9b7db60fd5 13 {
garyservin 0:9e9b7db60fd5 14
garyservin 0:9e9b7db60fd5 15 static const char APPLYBODYWRENCH[] = "gazebo_msgs/ApplyBodyWrench";
garyservin 0:9e9b7db60fd5 16
garyservin 0:9e9b7db60fd5 17 class ApplyBodyWrenchRequest : public ros::Msg
garyservin 0:9e9b7db60fd5 18 {
garyservin 0:9e9b7db60fd5 19 public:
garyservin 0:9e9b7db60fd5 20 typedef const char* _body_name_type;
garyservin 0:9e9b7db60fd5 21 _body_name_type body_name;
garyservin 0:9e9b7db60fd5 22 typedef const char* _reference_frame_type;
garyservin 0:9e9b7db60fd5 23 _reference_frame_type reference_frame;
garyservin 0:9e9b7db60fd5 24 typedef geometry_msgs::Point _reference_point_type;
garyservin 0:9e9b7db60fd5 25 _reference_point_type reference_point;
garyservin 0:9e9b7db60fd5 26 typedef geometry_msgs::Wrench _wrench_type;
garyservin 0:9e9b7db60fd5 27 _wrench_type wrench;
garyservin 0:9e9b7db60fd5 28 typedef ros::Time _start_time_type;
garyservin 0:9e9b7db60fd5 29 _start_time_type start_time;
garyservin 0:9e9b7db60fd5 30 typedef ros::Duration _duration_type;
garyservin 0:9e9b7db60fd5 31 _duration_type duration;
garyservin 0:9e9b7db60fd5 32
garyservin 0:9e9b7db60fd5 33 ApplyBodyWrenchRequest():
garyservin 0:9e9b7db60fd5 34 body_name(""),
garyservin 0:9e9b7db60fd5 35 reference_frame(""),
garyservin 0:9e9b7db60fd5 36 reference_point(),
garyservin 0:9e9b7db60fd5 37 wrench(),
garyservin 0:9e9b7db60fd5 38 start_time(),
garyservin 0:9e9b7db60fd5 39 duration()
garyservin 0:9e9b7db60fd5 40 {
garyservin 0:9e9b7db60fd5 41 }
garyservin 0:9e9b7db60fd5 42
garyservin 0:9e9b7db60fd5 43 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 44 {
garyservin 0:9e9b7db60fd5 45 int offset = 0;
garyservin 0:9e9b7db60fd5 46 uint32_t length_body_name = strlen(this->body_name);
garyservin 0:9e9b7db60fd5 47 varToArr(outbuffer + offset, length_body_name);
garyservin 0:9e9b7db60fd5 48 offset += 4;
garyservin 0:9e9b7db60fd5 49 memcpy(outbuffer + offset, this->body_name, length_body_name);
garyservin 0:9e9b7db60fd5 50 offset += length_body_name;
garyservin 0:9e9b7db60fd5 51 uint32_t length_reference_frame = strlen(this->reference_frame);
garyservin 0:9e9b7db60fd5 52 varToArr(outbuffer + offset, length_reference_frame);
garyservin 0:9e9b7db60fd5 53 offset += 4;
garyservin 0:9e9b7db60fd5 54 memcpy(outbuffer + offset, this->reference_frame, length_reference_frame);
garyservin 0:9e9b7db60fd5 55 offset += length_reference_frame;
garyservin 0:9e9b7db60fd5 56 offset += this->reference_point.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 57 offset += this->wrench.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 58 *(outbuffer + offset + 0) = (this->start_time.sec >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 59 *(outbuffer + offset + 1) = (this->start_time.sec >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 60 *(outbuffer + offset + 2) = (this->start_time.sec >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 61 *(outbuffer + offset + 3) = (this->start_time.sec >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 62 offset += sizeof(this->start_time.sec);
garyservin 0:9e9b7db60fd5 63 *(outbuffer + offset + 0) = (this->start_time.nsec >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 64 *(outbuffer + offset + 1) = (this->start_time.nsec >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 65 *(outbuffer + offset + 2) = (this->start_time.nsec >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 66 *(outbuffer + offset + 3) = (this->start_time.nsec >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 67 offset += sizeof(this->start_time.nsec);
garyservin 0:9e9b7db60fd5 68 *(outbuffer + offset + 0) = (this->duration.sec >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 69 *(outbuffer + offset + 1) = (this->duration.sec >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 70 *(outbuffer + offset + 2) = (this->duration.sec >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 71 *(outbuffer + offset + 3) = (this->duration.sec >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 72 offset += sizeof(this->duration.sec);
garyservin 0:9e9b7db60fd5 73 *(outbuffer + offset + 0) = (this->duration.nsec >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 74 *(outbuffer + offset + 1) = (this->duration.nsec >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 75 *(outbuffer + offset + 2) = (this->duration.nsec >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 76 *(outbuffer + offset + 3) = (this->duration.nsec >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 77 offset += sizeof(this->duration.nsec);
garyservin 0:9e9b7db60fd5 78 return offset;
garyservin 0:9e9b7db60fd5 79 }
garyservin 0:9e9b7db60fd5 80
garyservin 0:9e9b7db60fd5 81 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 82 {
garyservin 0:9e9b7db60fd5 83 int offset = 0;
garyservin 0:9e9b7db60fd5 84 uint32_t length_body_name;
garyservin 0:9e9b7db60fd5 85 arrToVar(length_body_name, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 86 offset += 4;
garyservin 0:9e9b7db60fd5 87 for(unsigned int k= offset; k< offset+length_body_name; ++k){
garyservin 0:9e9b7db60fd5 88 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 89 }
garyservin 0:9e9b7db60fd5 90 inbuffer[offset+length_body_name-1]=0;
garyservin 0:9e9b7db60fd5 91 this->body_name = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 92 offset += length_body_name;
garyservin 0:9e9b7db60fd5 93 uint32_t length_reference_frame;
garyservin 0:9e9b7db60fd5 94 arrToVar(length_reference_frame, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 95 offset += 4;
garyservin 0:9e9b7db60fd5 96 for(unsigned int k= offset; k< offset+length_reference_frame; ++k){
garyservin 0:9e9b7db60fd5 97 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 98 }
garyservin 0:9e9b7db60fd5 99 inbuffer[offset+length_reference_frame-1]=0;
garyservin 0:9e9b7db60fd5 100 this->reference_frame = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 101 offset += length_reference_frame;
garyservin 0:9e9b7db60fd5 102 offset += this->reference_point.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 103 offset += this->wrench.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 104 this->start_time.sec = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 105 this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 106 this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 107 this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 108 offset += sizeof(this->start_time.sec);
garyservin 0:9e9b7db60fd5 109 this->start_time.nsec = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 110 this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 111 this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 112 this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 113 offset += sizeof(this->start_time.nsec);
garyservin 0:9e9b7db60fd5 114 this->duration.sec = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 115 this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 116 this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 117 this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 118 offset += sizeof(this->duration.sec);
garyservin 0:9e9b7db60fd5 119 this->duration.nsec = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 120 this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 121 this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 122 this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 123 offset += sizeof(this->duration.nsec);
garyservin 0:9e9b7db60fd5 124 return offset;
garyservin 0:9e9b7db60fd5 125 }
garyservin 0:9e9b7db60fd5 126
garyservin 0:9e9b7db60fd5 127 const char * getType(){ return APPLYBODYWRENCH; };
garyservin 0:9e9b7db60fd5 128 const char * getMD5(){ return "e37e6adf97eba5095baa77dffb71e5bd"; };
garyservin 0:9e9b7db60fd5 129
garyservin 0:9e9b7db60fd5 130 };
garyservin 0:9e9b7db60fd5 131
garyservin 0:9e9b7db60fd5 132 class ApplyBodyWrenchResponse : public ros::Msg
garyservin 0:9e9b7db60fd5 133 {
garyservin 0:9e9b7db60fd5 134 public:
garyservin 0:9e9b7db60fd5 135 typedef bool _success_type;
garyservin 0:9e9b7db60fd5 136 _success_type success;
garyservin 0:9e9b7db60fd5 137 typedef const char* _status_message_type;
garyservin 0:9e9b7db60fd5 138 _status_message_type status_message;
garyservin 0:9e9b7db60fd5 139
garyservin 0:9e9b7db60fd5 140 ApplyBodyWrenchResponse():
garyservin 0:9e9b7db60fd5 141 success(0),
garyservin 0:9e9b7db60fd5 142 status_message("")
garyservin 0:9e9b7db60fd5 143 {
garyservin 0:9e9b7db60fd5 144 }
garyservin 0:9e9b7db60fd5 145
garyservin 0:9e9b7db60fd5 146 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 147 {
garyservin 0:9e9b7db60fd5 148 int offset = 0;
garyservin 0:9e9b7db60fd5 149 union {
garyservin 0:9e9b7db60fd5 150 bool real;
garyservin 0:9e9b7db60fd5 151 uint8_t base;
garyservin 0:9e9b7db60fd5 152 } u_success;
garyservin 0:9e9b7db60fd5 153 u_success.real = this->success;
garyservin 0:9e9b7db60fd5 154 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 155 offset += sizeof(this->success);
garyservin 0:9e9b7db60fd5 156 uint32_t length_status_message = strlen(this->status_message);
garyservin 0:9e9b7db60fd5 157 varToArr(outbuffer + offset, length_status_message);
garyservin 0:9e9b7db60fd5 158 offset += 4;
garyservin 0:9e9b7db60fd5 159 memcpy(outbuffer + offset, this->status_message, length_status_message);
garyservin 0:9e9b7db60fd5 160 offset += length_status_message;
garyservin 0:9e9b7db60fd5 161 return offset;
garyservin 0:9e9b7db60fd5 162 }
garyservin 0:9e9b7db60fd5 163
garyservin 0:9e9b7db60fd5 164 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 165 {
garyservin 0:9e9b7db60fd5 166 int offset = 0;
garyservin 0:9e9b7db60fd5 167 union {
garyservin 0:9e9b7db60fd5 168 bool real;
garyservin 0:9e9b7db60fd5 169 uint8_t base;
garyservin 0:9e9b7db60fd5 170 } u_success;
garyservin 0:9e9b7db60fd5 171 u_success.base = 0;
garyservin 0:9e9b7db60fd5 172 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
garyservin 0:9e9b7db60fd5 173 this->success = u_success.real;
garyservin 0:9e9b7db60fd5 174 offset += sizeof(this->success);
garyservin 0:9e9b7db60fd5 175 uint32_t length_status_message;
garyservin 0:9e9b7db60fd5 176 arrToVar(length_status_message, (inbuffer + offset));
garyservin 0:9e9b7db60fd5 177 offset += 4;
garyservin 0:9e9b7db60fd5 178 for(unsigned int k= offset; k< offset+length_status_message; ++k){
garyservin 0:9e9b7db60fd5 179 inbuffer[k-1]=inbuffer[k];
garyservin 0:9e9b7db60fd5 180 }
garyservin 0:9e9b7db60fd5 181 inbuffer[offset+length_status_message-1]=0;
garyservin 0:9e9b7db60fd5 182 this->status_message = (char *)(inbuffer + offset-1);
garyservin 0:9e9b7db60fd5 183 offset += length_status_message;
garyservin 0:9e9b7db60fd5 184 return offset;
garyservin 0:9e9b7db60fd5 185 }
garyservin 0:9e9b7db60fd5 186
garyservin 0:9e9b7db60fd5 187 const char * getType(){ return APPLYBODYWRENCH; };
garyservin 0:9e9b7db60fd5 188 const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; };
garyservin 0:9e9b7db60fd5 189
garyservin 0:9e9b7db60fd5 190 };
garyservin 0:9e9b7db60fd5 191
garyservin 0:9e9b7db60fd5 192 class ApplyBodyWrench {
garyservin 0:9e9b7db60fd5 193 public:
garyservin 0:9e9b7db60fd5 194 typedef ApplyBodyWrenchRequest Request;
garyservin 0:9e9b7db60fd5 195 typedef ApplyBodyWrenchResponse Response;
garyservin 0:9e9b7db60fd5 196 };
garyservin 0:9e9b7db60fd5 197
garyservin 0:9e9b7db60fd5 198 }
garyservin 0:9e9b7db60fd5 199 #endif