ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information
Dependents: rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more
JointTrajectoryPoint.h
00001 #ifndef _ROS_trajectory_msgs_JointTrajectoryPoint_h 00002 #define _ROS_trajectory_msgs_JointTrajectoryPoint_h 00003 00004 #include <stdint.h> 00005 #include <string.h> 00006 #include <stdlib.h> 00007 #include "ros/msg.h" 00008 #include "ros/duration.h" 00009 00010 namespace trajectory_msgs 00011 { 00012 00013 class JointTrajectoryPoint : public ros::Msg 00014 { 00015 public: 00016 uint8_t positions_length; 00017 double st_positions; 00018 double * positions; 00019 uint8_t velocities_length; 00020 double st_velocities; 00021 double * velocities; 00022 uint8_t accelerations_length; 00023 double st_accelerations; 00024 double * accelerations; 00025 uint8_t effort_length; 00026 double st_effort; 00027 double * effort; 00028 ros::Duration time_from_start; 00029 00030 JointTrajectoryPoint(): 00031 positions_length(0), positions(NULL), 00032 velocities_length(0), velocities(NULL), 00033 accelerations_length(0), accelerations(NULL), 00034 effort_length(0), effort(NULL), 00035 time_from_start() 00036 { 00037 } 00038 00039 virtual int serialize(unsigned char *outbuffer) const 00040 { 00041 int offset = 0; 00042 *(outbuffer + offset++) = positions_length; 00043 *(outbuffer + offset++) = 0; 00044 *(outbuffer + offset++) = 0; 00045 *(outbuffer + offset++) = 0; 00046 for( uint8_t i = 0; i < positions_length; i++){ 00047 union { 00048 double real; 00049 uint64_t base; 00050 } u_positionsi; 00051 u_positionsi.real = this->positions[i]; 00052 *(outbuffer + offset + 0) = (u_positionsi.base >> (8 * 0)) & 0xFF; 00053 *(outbuffer + offset + 1) = (u_positionsi.base >> (8 * 1)) & 0xFF; 00054 *(outbuffer + offset + 2) = (u_positionsi.base >> (8 * 2)) & 0xFF; 00055 *(outbuffer + offset + 3) = (u_positionsi.base >> (8 * 3)) & 0xFF; 00056 *(outbuffer + offset + 4) = (u_positionsi.base >> (8 * 4)) & 0xFF; 00057 *(outbuffer + offset + 5) = (u_positionsi.base >> (8 * 5)) & 0xFF; 00058 *(outbuffer + offset + 6) = (u_positionsi.base >> (8 * 6)) & 0xFF; 00059 *(outbuffer + offset + 7) = (u_positionsi.base >> (8 * 7)) & 0xFF; 00060 offset += sizeof(this->positions[i]); 00061 } 00062 *(outbuffer + offset++) = velocities_length; 00063 *(outbuffer + offset++) = 0; 00064 *(outbuffer + offset++) = 0; 00065 *(outbuffer + offset++) = 0; 00066 for( uint8_t i = 0; i < velocities_length; i++){ 00067 union { 00068 double real; 00069 uint64_t base; 00070 } u_velocitiesi; 00071 u_velocitiesi.real = this->velocities[i]; 00072 *(outbuffer + offset + 0) = (u_velocitiesi.base >> (8 * 0)) & 0xFF; 00073 *(outbuffer + offset + 1) = (u_velocitiesi.base >> (8 * 1)) & 0xFF; 00074 *(outbuffer + offset + 2) = (u_velocitiesi.base >> (8 * 2)) & 0xFF; 00075 *(outbuffer + offset + 3) = (u_velocitiesi.base >> (8 * 3)) & 0xFF; 00076 *(outbuffer + offset + 4) = (u_velocitiesi.base >> (8 * 4)) & 0xFF; 00077 *(outbuffer + offset + 5) = (u_velocitiesi.base >> (8 * 5)) & 0xFF; 00078 *(outbuffer + offset + 6) = (u_velocitiesi.base >> (8 * 6)) & 0xFF; 00079 *(outbuffer + offset + 7) = (u_velocitiesi.base >> (8 * 7)) & 0xFF; 00080 offset += sizeof(this->velocities[i]); 00081 } 00082 *(outbuffer + offset++) = accelerations_length; 00083 *(outbuffer + offset++) = 0; 00084 *(outbuffer + offset++) = 0; 00085 *(outbuffer + offset++) = 0; 00086 for( uint8_t i = 0; i < accelerations_length; i++){ 00087 union { 00088 double real; 00089 uint64_t base; 00090 } u_accelerationsi; 00091 u_accelerationsi.real = this->accelerations[i]; 00092 *(outbuffer + offset + 0) = (u_accelerationsi.base >> (8 * 0)) & 0xFF; 00093 *(outbuffer + offset + 1) = (u_accelerationsi.base >> (8 * 1)) & 0xFF; 00094 *(outbuffer + offset + 2) = (u_accelerationsi.base >> (8 * 2)) & 0xFF; 00095 *(outbuffer + offset + 3) = (u_accelerationsi.base >> (8 * 3)) & 0xFF; 00096 *(outbuffer + offset + 4) = (u_accelerationsi.base >> (8 * 4)) & 0xFF; 00097 *(outbuffer + offset + 5) = (u_accelerationsi.base >> (8 * 5)) & 0xFF; 00098 *(outbuffer + offset + 6) = (u_accelerationsi.base >> (8 * 6)) & 0xFF; 00099 *(outbuffer + offset + 7) = (u_accelerationsi.base >> (8 * 7)) & 0xFF; 00100 offset += sizeof(this->accelerations[i]); 00101 } 00102 *(outbuffer + offset++) = effort_length; 00103 *(outbuffer + offset++) = 0; 00104 *(outbuffer + offset++) = 0; 00105 *(outbuffer + offset++) = 0; 00106 for( uint8_t i = 0; i < effort_length; i++){ 00107 union { 00108 double real; 00109 uint64_t base; 00110 } u_efforti; 00111 u_efforti.real = this->effort[i]; 00112 *(outbuffer + offset + 0) = (u_efforti.base >> (8 * 0)) & 0xFF; 00113 *(outbuffer + offset + 1) = (u_efforti.base >> (8 * 1)) & 0xFF; 00114 *(outbuffer + offset + 2) = (u_efforti.base >> (8 * 2)) & 0xFF; 00115 *(outbuffer + offset + 3) = (u_efforti.base >> (8 * 3)) & 0xFF; 00116 *(outbuffer + offset + 4) = (u_efforti.base >> (8 * 4)) & 0xFF; 00117 *(outbuffer + offset + 5) = (u_efforti.base >> (8 * 5)) & 0xFF; 00118 *(outbuffer + offset + 6) = (u_efforti.base >> (8 * 6)) & 0xFF; 00119 *(outbuffer + offset + 7) = (u_efforti.base >> (8 * 7)) & 0xFF; 00120 offset += sizeof(this->effort[i]); 00121 } 00122 *(outbuffer + offset + 0) = (this->time_from_start.sec >> (8 * 0)) & 0xFF; 00123 *(outbuffer + offset + 1) = (this->time_from_start.sec >> (8 * 1)) & 0xFF; 00124 *(outbuffer + offset + 2) = (this->time_from_start.sec >> (8 * 2)) & 0xFF; 00125 *(outbuffer + offset + 3) = (this->time_from_start.sec >> (8 * 3)) & 0xFF; 00126 offset += sizeof(this->time_from_start.sec); 00127 *(outbuffer + offset + 0) = (this->time_from_start.nsec >> (8 * 0)) & 0xFF; 00128 *(outbuffer + offset + 1) = (this->time_from_start.nsec >> (8 * 1)) & 0xFF; 00129 *(outbuffer + offset + 2) = (this->time_from_start.nsec >> (8 * 2)) & 0xFF; 00130 *(outbuffer + offset + 3) = (this->time_from_start.nsec >> (8 * 3)) & 0xFF; 00131 offset += sizeof(this->time_from_start.nsec); 00132 return offset; 00133 } 00134 00135 virtual int deserialize(unsigned char *inbuffer) 00136 { 00137 int offset = 0; 00138 uint8_t positions_lengthT = *(inbuffer + offset++); 00139 if(positions_lengthT > positions_length) 00140 this->positions = (double*)realloc(this->positions, positions_lengthT * sizeof(double)); 00141 offset += 3; 00142 positions_length = positions_lengthT; 00143 for( uint8_t i = 0; i < positions_length; i++){ 00144 union { 00145 double real; 00146 uint64_t base; 00147 } u_st_positions; 00148 u_st_positions.base = 0; 00149 u_st_positions.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00150 u_st_positions.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00151 u_st_positions.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00152 u_st_positions.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00153 u_st_positions.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00154 u_st_positions.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00155 u_st_positions.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00156 u_st_positions.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00157 this->st_positions = u_st_positions.real; 00158 offset += sizeof(this->st_positions); 00159 memcpy( &(this->positions[i]), &(this->st_positions), sizeof(double)); 00160 } 00161 uint8_t velocities_lengthT = *(inbuffer + offset++); 00162 if(velocities_lengthT > velocities_length) 00163 this->velocities = (double*)realloc(this->velocities, velocities_lengthT * sizeof(double)); 00164 offset += 3; 00165 velocities_length = velocities_lengthT; 00166 for( uint8_t i = 0; i < velocities_length; i++){ 00167 union { 00168 double real; 00169 uint64_t base; 00170 } u_st_velocities; 00171 u_st_velocities.base = 0; 00172 u_st_velocities.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00173 u_st_velocities.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00174 u_st_velocities.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00175 u_st_velocities.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00176 u_st_velocities.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00177 u_st_velocities.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00178 u_st_velocities.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00179 u_st_velocities.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00180 this->st_velocities = u_st_velocities.real; 00181 offset += sizeof(this->st_velocities); 00182 memcpy( &(this->velocities[i]), &(this->st_velocities), sizeof(double)); 00183 } 00184 uint8_t accelerations_lengthT = *(inbuffer + offset++); 00185 if(accelerations_lengthT > accelerations_length) 00186 this->accelerations = (double*)realloc(this->accelerations, accelerations_lengthT * sizeof(double)); 00187 offset += 3; 00188 accelerations_length = accelerations_lengthT; 00189 for( uint8_t i = 0; i < accelerations_length; i++){ 00190 union { 00191 double real; 00192 uint64_t base; 00193 } u_st_accelerations; 00194 u_st_accelerations.base = 0; 00195 u_st_accelerations.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00196 u_st_accelerations.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00197 u_st_accelerations.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00198 u_st_accelerations.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00199 u_st_accelerations.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00200 u_st_accelerations.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00201 u_st_accelerations.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00202 u_st_accelerations.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00203 this->st_accelerations = u_st_accelerations.real; 00204 offset += sizeof(this->st_accelerations); 00205 memcpy( &(this->accelerations[i]), &(this->st_accelerations), sizeof(double)); 00206 } 00207 uint8_t effort_lengthT = *(inbuffer + offset++); 00208 if(effort_lengthT > effort_length) 00209 this->effort = (double*)realloc(this->effort, effort_lengthT * sizeof(double)); 00210 offset += 3; 00211 effort_length = effort_lengthT; 00212 for( uint8_t i = 0; i < effort_length; i++){ 00213 union { 00214 double real; 00215 uint64_t base; 00216 } u_st_effort; 00217 u_st_effort.base = 0; 00218 u_st_effort.base |= ((uint64_t) (*(inbuffer + offset + 0))) << (8 * 0); 00219 u_st_effort.base |= ((uint64_t) (*(inbuffer + offset + 1))) << (8 * 1); 00220 u_st_effort.base |= ((uint64_t) (*(inbuffer + offset + 2))) << (8 * 2); 00221 u_st_effort.base |= ((uint64_t) (*(inbuffer + offset + 3))) << (8 * 3); 00222 u_st_effort.base |= ((uint64_t) (*(inbuffer + offset + 4))) << (8 * 4); 00223 u_st_effort.base |= ((uint64_t) (*(inbuffer + offset + 5))) << (8 * 5); 00224 u_st_effort.base |= ((uint64_t) (*(inbuffer + offset + 6))) << (8 * 6); 00225 u_st_effort.base |= ((uint64_t) (*(inbuffer + offset + 7))) << (8 * 7); 00226 this->st_effort = u_st_effort.real; 00227 offset += sizeof(this->st_effort); 00228 memcpy( &(this->effort[i]), &(this->st_effort), sizeof(double)); 00229 } 00230 this->time_from_start.sec = ((uint32_t) (*(inbuffer + offset))); 00231 this->time_from_start.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00232 this->time_from_start.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00233 this->time_from_start.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00234 offset += sizeof(this->time_from_start.sec); 00235 this->time_from_start.nsec = ((uint32_t) (*(inbuffer + offset))); 00236 this->time_from_start.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00237 this->time_from_start.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00238 this->time_from_start.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00239 offset += sizeof(this->time_from_start.nsec); 00240 return offset; 00241 } 00242 00243 const char * getType(){ return "trajectory_msgs/JointTrajectoryPoint"; }; 00244 const char * getMD5(){ return "f3cd1e1c4d320c79d6985c904ae5dcd3"; }; 00245 00246 }; 00247 00248 } 00249 #endif
Generated on Tue Jul 12 2022 18:39:39 by 1.7.2