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