It has only one change from original one. I added robotfeedback message on it.

Dependencies:   BufferedSerial

Dependents:   RobotFeedback mobileRobotITU

Fork of ros_lib_indigo by Gary Servin

Committer:
randalthor
Date:
Sat Mar 04 14:07:56 2017 +0000
Revision:
4:80d9bee5079a
Parent:
0:fd24f7ca9688
fatih

Who changed what in which revision?

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