Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ApplyBodyWrench.h Source File

ApplyBodyWrench.h

00001 #ifndef _ROS_SERVICE_ApplyBodyWrench_h
00002 #define _ROS_SERVICE_ApplyBodyWrench_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "ros/duration.h"
00008 #include "geometry_msgs/Wrench.h"
00009 #include "ros/time.h"
00010 #include "geometry_msgs/Point.h"
00011 
00012 namespace gazebo_msgs
00013 {
00014 
00015 static const char APPLYBODYWRENCH[] = "gazebo_msgs/ApplyBodyWrench";
00016 
00017   class ApplyBodyWrenchRequest : public ros::Msg
00018   {
00019     public:
00020       typedef const char* _body_name_type;
00021       _body_name_type body_name;
00022       typedef const char* _reference_frame_type;
00023       _reference_frame_type reference_frame;
00024       typedef geometry_msgs::Point _reference_point_type;
00025       _reference_point_type reference_point;
00026       typedef geometry_msgs::Wrench _wrench_type;
00027       _wrench_type wrench;
00028       typedef ros::Time _start_time_type;
00029       _start_time_type start_time;
00030       typedef ros::Duration _duration_type;
00031       _duration_type duration;
00032 
00033     ApplyBodyWrenchRequest():
00034       body_name(""),
00035       reference_frame(""),
00036       reference_point(),
00037       wrench(),
00038       start_time(),
00039       duration()
00040     {
00041     }
00042 
00043     virtual int serialize(unsigned char *outbuffer) const
00044     {
00045       int offset = 0;
00046       uint32_t length_body_name = strlen(this->body_name);
00047       varToArr(outbuffer + offset, length_body_name);
00048       offset += 4;
00049       memcpy(outbuffer + offset, this->body_name, length_body_name);
00050       offset += length_body_name;
00051       uint32_t length_reference_frame = strlen(this->reference_frame);
00052       varToArr(outbuffer + offset, length_reference_frame);
00053       offset += 4;
00054       memcpy(outbuffer + offset, this->reference_frame, length_reference_frame);
00055       offset += length_reference_frame;
00056       offset += this->reference_point.serialize(outbuffer + offset);
00057       offset += this->wrench.serialize(outbuffer + offset);
00058       *(outbuffer + offset + 0) = (this->start_time.sec >> (8 * 0)) & 0xFF;
00059       *(outbuffer + offset + 1) = (this->start_time.sec >> (8 * 1)) & 0xFF;
00060       *(outbuffer + offset + 2) = (this->start_time.sec >> (8 * 2)) & 0xFF;
00061       *(outbuffer + offset + 3) = (this->start_time.sec >> (8 * 3)) & 0xFF;
00062       offset += sizeof(this->start_time.sec);
00063       *(outbuffer + offset + 0) = (this->start_time.nsec >> (8 * 0)) & 0xFF;
00064       *(outbuffer + offset + 1) = (this->start_time.nsec >> (8 * 1)) & 0xFF;
00065       *(outbuffer + offset + 2) = (this->start_time.nsec >> (8 * 2)) & 0xFF;
00066       *(outbuffer + offset + 3) = (this->start_time.nsec >> (8 * 3)) & 0xFF;
00067       offset += sizeof(this->start_time.nsec);
00068       *(outbuffer + offset + 0) = (this->duration.sec >> (8 * 0)) & 0xFF;
00069       *(outbuffer + offset + 1) = (this->duration.sec >> (8 * 1)) & 0xFF;
00070       *(outbuffer + offset + 2) = (this->duration.sec >> (8 * 2)) & 0xFF;
00071       *(outbuffer + offset + 3) = (this->duration.sec >> (8 * 3)) & 0xFF;
00072       offset += sizeof(this->duration.sec);
00073       *(outbuffer + offset + 0) = (this->duration.nsec >> (8 * 0)) & 0xFF;
00074       *(outbuffer + offset + 1) = (this->duration.nsec >> (8 * 1)) & 0xFF;
00075       *(outbuffer + offset + 2) = (this->duration.nsec >> (8 * 2)) & 0xFF;
00076       *(outbuffer + offset + 3) = (this->duration.nsec >> (8 * 3)) & 0xFF;
00077       offset += sizeof(this->duration.nsec);
00078       return offset;
00079     }
00080 
00081     virtual int deserialize(unsigned char *inbuffer)
00082     {
00083       int offset = 0;
00084       uint32_t length_body_name;
00085       arrToVar(length_body_name, (inbuffer + offset));
00086       offset += 4;
00087       for(unsigned int k= offset; k< offset+length_body_name; ++k){
00088           inbuffer[k-1]=inbuffer[k];
00089       }
00090       inbuffer[offset+length_body_name-1]=0;
00091       this->body_name = (char *)(inbuffer + offset-1);
00092       offset += length_body_name;
00093       uint32_t length_reference_frame;
00094       arrToVar(length_reference_frame, (inbuffer + offset));
00095       offset += 4;
00096       for(unsigned int k= offset; k< offset+length_reference_frame; ++k){
00097           inbuffer[k-1]=inbuffer[k];
00098       }
00099       inbuffer[offset+length_reference_frame-1]=0;
00100       this->reference_frame = (char *)(inbuffer + offset-1);
00101       offset += length_reference_frame;
00102       offset += this->reference_point.deserialize(inbuffer + offset);
00103       offset += this->wrench.deserialize(inbuffer + offset);
00104       this->start_time.sec =  ((uint32_t) (*(inbuffer + offset)));
00105       this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00106       this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00107       this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00108       offset += sizeof(this->start_time.sec);
00109       this->start_time.nsec =  ((uint32_t) (*(inbuffer + offset)));
00110       this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00111       this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00112       this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00113       offset += sizeof(this->start_time.nsec);
00114       this->duration.sec =  ((uint32_t) (*(inbuffer + offset)));
00115       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00116       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00117       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00118       offset += sizeof(this->duration.sec);
00119       this->duration.nsec =  ((uint32_t) (*(inbuffer + offset)));
00120       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00121       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00122       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00123       offset += sizeof(this->duration.nsec);
00124      return offset;
00125     }
00126 
00127     const char * getType(){ return APPLYBODYWRENCH; };
00128     const char * getMD5(){ return "e37e6adf97eba5095baa77dffb71e5bd"; };
00129 
00130   };
00131 
00132   class ApplyBodyWrenchResponse : public ros::Msg
00133   {
00134     public:
00135       typedef bool _success_type;
00136       _success_type success;
00137       typedef const char* _status_message_type;
00138       _status_message_type status_message;
00139 
00140     ApplyBodyWrenchResponse():
00141       success(0),
00142       status_message("")
00143     {
00144     }
00145 
00146     virtual int serialize(unsigned char *outbuffer) const
00147     {
00148       int offset = 0;
00149       union {
00150         bool real;
00151         uint8_t base;
00152       } u_success;
00153       u_success.real = this->success;
00154       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00155       offset += sizeof(this->success);
00156       uint32_t length_status_message = strlen(this->status_message);
00157       varToArr(outbuffer + offset, length_status_message);
00158       offset += 4;
00159       memcpy(outbuffer + offset, this->status_message, length_status_message);
00160       offset += length_status_message;
00161       return offset;
00162     }
00163 
00164     virtual int deserialize(unsigned char *inbuffer)
00165     {
00166       int offset = 0;
00167       union {
00168         bool real;
00169         uint8_t base;
00170       } u_success;
00171       u_success.base = 0;
00172       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00173       this->success = u_success.real;
00174       offset += sizeof(this->success);
00175       uint32_t length_status_message;
00176       arrToVar(length_status_message, (inbuffer + offset));
00177       offset += 4;
00178       for(unsigned int k= offset; k< offset+length_status_message; ++k){
00179           inbuffer[k-1]=inbuffer[k];
00180       }
00181       inbuffer[offset+length_status_message-1]=0;
00182       this->status_message = (char *)(inbuffer + offset-1);
00183       offset += length_status_message;
00184      return offset;
00185     }
00186 
00187     const char * getType(){ return APPLYBODYWRENCH; };
00188     const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; };
00189 
00190   };
00191 
00192   class ApplyBodyWrench {
00193     public:
00194     typedef ApplyBodyWrenchRequest Request;
00195     typedef ApplyBodyWrenchResponse Response;
00196   };
00197 
00198 }
00199 #endif