Working towards recieving twists
Fork of ros_lib_kinetic by
Embed:
(wiki syntax)
Show/hide line numbers
JointTolerance.h
00001 #ifndef _ROS_control_msgs_JointTolerance_h 00002 #define _ROS_control_msgs_JointTolerance_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 00009 namespace control_msgs 00010 { 00011 00012 class JointTolerance : public ros::Msg 00013 { 00014 public: 00015 typedef const char* _name_type; 00016 _name_type name; 00017 typedef double _position_type; 00018 _position_type position; 00019 typedef double _velocity_type; 00020 _velocity_type velocity; 00021 typedef double _acceleration_type; 00022 _acceleration_type acceleration; 00023 00024 JointTolerance(): 00025 name(""), 00026 position(0), 00027 velocity(0), 00028 acceleration(0) 00029 { 00030 } 00031 00032 virtual int serialize(unsigned char *outbuffer) const 00033 { 00034 int offset = 0; 00035 uint32_t length_name = strlen(this->name); 00036 varToArr(outbuffer + offset, length_name); 00037 offset += 4; 00038 memcpy(outbuffer + offset, this->name, length_name); 00039 offset += length_name; 00040 union { 00041 double real; 00042 uint64_t base; 00043 } u_position; 00044 u_position.real = this->position; 00045 *(outbuffer + offset + 0) = (u_position.base >> (8 * 0)) & 0xFF; 00046 *(outbuffer + offset + 1) = (u_position.base >> (8 * 1)) & 0xFF; 00047 *(outbuffer + offset + 2) = (u_position.base >> (8 * 2)) & 0xFF; 00048 *(outbuffer + offset + 3) = (u_position.base >> (8 * 3)) & 0xFF; 00049 *(outbuffer + offset + 4) = (u_position.base >> (8 * 4)) & 0xFF; 00050 *(outbuffer + offset + 5) = (u_position.base >> (8 * 5)) & 0xFF; 00051 *(outbuffer + offset + 6) = (u_position.base >> (8 * 6)) & 0xFF; 00052 *(outbuffer + offset + 7) = (u_position.base >> (8 * 7)) & 0xFF; 00053 offset += sizeof(this->position); 00054 union { 00055 double real; 00056 uint64_t base; 00057 } u_velocity; 00058 u_velocity.real = this->velocity; 00059 *(outbuffer + offset + 0) = (u_velocity.base >> (8 * 0)) & 0xFF; 00060 *(outbuffer + offset + 1) = (u_velocity.base >> (8 * 1)) & 0xFF; 00061 *(outbuffer + offset + 2) = (u_velocity.base >> (8 * 2)) & 0xFF; 00062 *(outbuffer + offset + 3) = (u_velocity.base >> (8 * 3)) & 0xFF; 00063 *(outbuffer + offset + 4) = (u_velocity.base >> (8 * 4)) & 0xFF; 00064 *(outbuffer + offset + 5) = (u_velocity.base >> (8 * 5)) & 0xFF; 00065 *(outbuffer + offset + 6) = (u_velocity.base >> (8 * 6)) & 0xFF; 00066 *(outbuffer + offset + 7) = (u_velocity.base >> (8 * 7)) & 0xFF; 00067 offset += sizeof(this->velocity); 00068 union { 00069 double real; 00070 uint64_t base; 00071 } u_acceleration; 00072 u_acceleration.real = this->acceleration; 00073 *(outbuffer + offset + 0) = (u_acceleration.base >> (8 * 0)) & 0xFF; 00074 *(outbuffer + offset + 1) = (u_acceleration.base >> (8 * 1)) & 0xFF; 00075 *(outbuffer + offset + 2) = (u_acceleration.base >> (8 * 2)) & 0xFF; 00076 *(outbuffer + offset + 3) = (u_acceleration.base >> (8 * 3)) & 0xFF; 00077 *(outbuffer + offset + 4) = (u_acceleration.base >> (8 * 4)) & 0xFF; 00078 *(outbuffer + offset + 5) = (u_acceleration.base >> (8 * 5)) & 0xFF; 00079 *(outbuffer + offset + 6) = (u_acceleration.base >> (8 * 6)) & 0xFF; 00080 *(outbuffer + offset + 7) = (u_acceleration.base >> (8 * 7)) & 0xFF; 00081 offset += sizeof(this->acceleration); 00082 return offset; 00083 } 00084 00085 virtual int deserialize(unsigned char *inbuffer) 00086 { 00087 int offset = 0; 00088 uint32_t length_name; 00089 arrToVar(length_name, (inbuffer + offset)); 00090 offset += 4; 00091 for(unsigned int k= offset; k< offset+length_name; ++k){ 00092 inbuffer[k-1]=inbuffer[k]; 00093 } 00094 inbuffer[offset+length_name-1]=0; 00095 this->name = (char *)(inbuffer + offset-1); 00096 offset += length_name; 00097 union { 00098 double real; 00099 uint64_t base; 00100 } u_position; 00101 u_position.base = 0; 00102 u_position.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00103 u_position.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00104 u_position.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00105 u_position.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00106 u_position.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00107 u_position.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00108 u_position.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00109 u_position.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00110 this->position = u_position.real; 00111 offset += sizeof(this->position); 00112 union { 00113 double real; 00114 uint64_t base; 00115 } u_velocity; 00116 u_velocity.base = 0; 00117 u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00118 u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00119 u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00120 u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00121 u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00122 u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00123 u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00124 u_velocity.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00125 this->velocity = u_velocity.real; 00126 offset += sizeof(this->velocity); 00127 union { 00128 double real; 00129 uint64_t base; 00130 } u_acceleration; 00131 u_acceleration.base = 0; 00132 u_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00133 u_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00134 u_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00135 u_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00136 u_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00137 u_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00138 u_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00139 u_acceleration.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00140 this->acceleration = u_acceleration.real; 00141 offset += sizeof(this->acceleration); 00142 return offset; 00143 } 00144 00145 const char * getType(){ return "control_msgs/JointTolerance"; }; 00146 const char * getMD5(){ return "f544fe9c16cf04547e135dd6063ff5be"; }; 00147 00148 }; 00149 00150 } 00151 #endif
Generated on Tue Jul 12 2022 21:32:16 by 1.7.2