ApplyJointEffort.h
Go to the documentation of this file.
00001 #ifndef _ROS_SERVICE_ApplyJointEffort_h
00002 #define _ROS_SERVICE_ApplyJointEffort_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 "ros/time.h"
00009 
00010 namespace gazebo_msgs
00011 {
00012 
00013 static const char APPLYJOINTEFFORT[] = "gazebo_msgs/ApplyJointEffort";
00014 
00015   class ApplyJointEffortRequest : public ros::Msg
00016   {
00017     public:
00018       const char* joint_name;
00019       float effort;
00020       ros::Time start_time;
00021       ros::Duration duration;
00022 
00023     virtual int serialize(unsigned char *outbuffer) const
00024     {
00025       int offset = 0;
00026       uint32_t length_joint_name = strlen(this->joint_name);
00027       memcpy(outbuffer + offset, &length_joint_name, sizeof(uint32_t));
00028       offset += 4;
00029       memcpy(outbuffer + offset, this->joint_name, length_joint_name);
00030       offset += length_joint_name;
00031       int32_t * val_effort = (int32_t *) &(this->effort);
00032       int32_t exp_effort = (((*val_effort)>>23)&255);
00033       if(exp_effort != 0)
00034         exp_effort += 1023-127;
00035       int32_t sig_effort = *val_effort;
00036       *(outbuffer + offset++) = 0;
00037       *(outbuffer + offset++) = 0;
00038       *(outbuffer + offset++) = 0;
00039       *(outbuffer + offset++) = (sig_effort<<5) & 0xff;
00040       *(outbuffer + offset++) = (sig_effort>>3) & 0xff;
00041       *(outbuffer + offset++) = (sig_effort>>11) & 0xff;
00042       *(outbuffer + offset++) = ((exp_effort<<4) & 0xF0) | ((sig_effort>>19)&0x0F);
00043       *(outbuffer + offset++) = (exp_effort>>4) & 0x7F;
00044       if(this->effort < 0) *(outbuffer + offset -1) |= 0x80;
00045       *(outbuffer + offset + 0) = (this->start_time.sec >> (8 * 0)) & 0xFF;
00046       *(outbuffer + offset + 1) = (this->start_time.sec >> (8 * 1)) & 0xFF;
00047       *(outbuffer + offset + 2) = (this->start_time.sec >> (8 * 2)) & 0xFF;
00048       *(outbuffer + offset + 3) = (this->start_time.sec >> (8 * 3)) & 0xFF;
00049       offset += sizeof(this->start_time.sec);
00050       *(outbuffer + offset + 0) = (this->start_time.nsec >> (8 * 0)) & 0xFF;
00051       *(outbuffer + offset + 1) = (this->start_time.nsec >> (8 * 1)) & 0xFF;
00052       *(outbuffer + offset + 2) = (this->start_time.nsec >> (8 * 2)) & 0xFF;
00053       *(outbuffer + offset + 3) = (this->start_time.nsec >> (8 * 3)) & 0xFF;
00054       offset += sizeof(this->start_time.nsec);
00055       *(outbuffer + offset + 0) = (this->duration.sec >> (8 * 0)) & 0xFF;
00056       *(outbuffer + offset + 1) = (this->duration.sec >> (8 * 1)) & 0xFF;
00057       *(outbuffer + offset + 2) = (this->duration.sec >> (8 * 2)) & 0xFF;
00058       *(outbuffer + offset + 3) = (this->duration.sec >> (8 * 3)) & 0xFF;
00059       offset += sizeof(this->duration.sec);
00060       *(outbuffer + offset + 0) = (this->duration.nsec >> (8 * 0)) & 0xFF;
00061       *(outbuffer + offset + 1) = (this->duration.nsec >> (8 * 1)) & 0xFF;
00062       *(outbuffer + offset + 2) = (this->duration.nsec >> (8 * 2)) & 0xFF;
00063       *(outbuffer + offset + 3) = (this->duration.nsec >> (8 * 3)) & 0xFF;
00064       offset += sizeof(this->duration.nsec);
00065       return offset;
00066     }
00067 
00068     virtual int deserialize(unsigned char *inbuffer)
00069     {
00070       int offset = 0;
00071       uint32_t length_joint_name;
00072       memcpy(&length_joint_name, (inbuffer + offset), sizeof(uint32_t));
00073       offset += 4;
00074       for(unsigned int k= offset; k< offset+length_joint_name; ++k){
00075           inbuffer[k-1]=inbuffer[k];
00076       }
00077       inbuffer[offset+length_joint_name-1]=0;
00078       this->joint_name = (char *)(inbuffer + offset-1);
00079       offset += length_joint_name;
00080       uint32_t * val_effort = (uint32_t*) &(this->effort);
00081       offset += 3;
00082       *val_effort = ((uint32_t)(*(inbuffer + offset++))>>5 & 0x07);
00083       *val_effort |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<3;
00084       *val_effort |= ((uint32_t)(*(inbuffer + offset++)) & 0xff)<<11;
00085       *val_effort |= ((uint32_t)(*(inbuffer + offset)) & 0x0f)<<19;
00086       uint32_t exp_effort = ((uint32_t)(*(inbuffer + offset++))&0xf0)>>4;
00087       exp_effort |= ((uint32_t)(*(inbuffer + offset)) & 0x7f)<<4;
00088       if(exp_effort !=0)
00089         *val_effort |= ((exp_effort)-1023+127)<<23;
00090       if( ((*(inbuffer+offset++)) & 0x80) > 0) this->effort = -this->effort;
00091       this->start_time.sec =  ((uint32_t) (*(inbuffer + offset)));
00092       this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00093       this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00094       this->start_time.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00095       offset += sizeof(this->start_time.sec);
00096       this->start_time.nsec =  ((uint32_t) (*(inbuffer + offset)));
00097       this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00098       this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00099       this->start_time.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00100       offset += sizeof(this->start_time.nsec);
00101       this->duration.sec =  ((uint32_t) (*(inbuffer + offset)));
00102       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00103       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00104       this->duration.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00105       offset += sizeof(this->duration.sec);
00106       this->duration.nsec =  ((uint32_t) (*(inbuffer + offset)));
00107       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00108       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00109       this->duration.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00110       offset += sizeof(this->duration.nsec);
00111      return offset;
00112     }
00113 
00114     const char * getType(){ return APPLYJOINTEFFORT; };
00115     const char * getMD5(){ return "2c3396ab9af67a509ecd2167a8fe41a2"; };
00116 
00117   };
00118 
00119   class ApplyJointEffortResponse : public ros::Msg
00120   {
00121     public:
00122       bool success;
00123       const char* status_message;
00124 
00125     virtual int serialize(unsigned char *outbuffer) const
00126     {
00127       int offset = 0;
00128       union {
00129         bool real;
00130         uint8_t base;
00131       } u_success;
00132       u_success.real = this->success;
00133       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00134       offset += sizeof(this->success);
00135       uint32_t length_status_message = strlen(this->status_message);
00136       memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
00137       offset += 4;
00138       memcpy(outbuffer + offset, this->status_message, length_status_message);
00139       offset += length_status_message;
00140       return offset;
00141     }
00142 
00143     virtual int deserialize(unsigned char *inbuffer)
00144     {
00145       int offset = 0;
00146       union {
00147         bool real;
00148         uint8_t base;
00149       } u_success;
00150       u_success.base = 0;
00151       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00152       this->success = u_success.real;
00153       offset += sizeof(this->success);
00154       uint32_t length_status_message;
00155       memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
00156       offset += 4;
00157       for(unsigned int k= offset; k< offset+length_status_message; ++k){
00158           inbuffer[k-1]=inbuffer[k];
00159       }
00160       inbuffer[offset+length_status_message-1]=0;
00161       this->status_message = (char *)(inbuffer + offset-1);
00162       offset += length_status_message;
00163      return offset;
00164     }
00165 
00166     const char * getType(){ return APPLYJOINTEFFORT; };
00167     const char * getMD5(){ return "2ec6f3eff0161f4257b808b12bc830c2"; };
00168 
00169   };
00170 
00171   class ApplyJointEffort {
00172     public:
00173     typedef ApplyJointEffortRequest Request;
00174     typedef ApplyJointEffortResponse Response;
00175   };
00176 
00177 }
00178 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Fri May 20 2016 03:48:54