Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef JOINT_TRAJ_PT_FULL_H
00033 #define JOINT_TRAJ_PT_FULL_H
00034
00035 #ifndef FLATHEADERS
00036 #include "simple_message/joint_data.h"
00037 #include "simple_message/simple_message.h"
00038 #include "simple_message/simple_serialize.h"
00039 #include "simple_message/shared_types.h"
00040 #else
00041 #include "joint_data.h"
00042 #include "simple_message.h"
00043 #include "simple_serialize.h"
00044 #include "shared_types.h"
00045 #endif
00046
00047 namespace industrial
00048 {
00049 namespace joint_traj_pt_full
00050 {
00051
00052 namespace SpecialSeqValues
00053 {
00054 enum SpecialSeqValue
00055 {
00056 START_TRAJECTORY_DOWNLOAD = -1, START_TRAJECOTRY_STREAMING = -2, END_TRAJECTORY = -3, STOP_TRAJECTORY = -4
00057 };
00058 }
00059 typedef SpecialSeqValues::SpecialSeqValue SpecialSeqValue;
00060
00061 namespace ValidFieldTypes
00062 {
00063 enum ValidFieldType
00064 {
00065 TIME = 0x01, POSITION = 0x02, VELOCITY = 0x04, ACCELERATION = 0x08
00066 };
00067 }
00068 typedef ValidFieldTypes::ValidFieldType ValidFieldType;
00069
00096 class JointTrajPtFull : public industrial::simple_serialize::SimpleSerialize
00097 {
00098 public:
00099
00106 JointTrajPtFull(void);
00111 ~JointTrajPtFull(void);
00112
00117 void init();
00118
00123 void init(industrial::shared_types::shared_int robot_id,
00124 industrial::shared_types::shared_int sequence,
00125 industrial::shared_types::shared_int valid_fields,
00126 industrial::shared_types::shared_real time,
00127 industrial::joint_data::JointData & positions,
00128 industrial::joint_data::JointData & velocities,
00129 industrial::joint_data::JointData & accelerations);
00130
00137 void setRobotID(industrial::shared_types::shared_int robot_id)
00138 {
00139 this->robot_id_ = robot_id;
00140 }
00141
00148 industrial::shared_types::shared_int getRobotID()
00149 {
00150 return this->robot_id_;
00151 }
00152
00158 void setSequence(industrial::shared_types::shared_int sequence)
00159 {
00160 this->sequence_ = sequence;
00161 }
00162
00168 industrial::shared_types::shared_int getSequence()
00169 {
00170 return this->sequence_;
00171 }
00172
00178 void setTime(industrial::shared_types::shared_real time)
00179 {
00180 this->time_ = time;
00181 this->valid_fields_ |= ValidFieldTypes::TIME;
00182 }
00183
00190 bool getTime(industrial::shared_types::shared_real & time)
00191 {
00192 time = this->time_;
00193 return is_valid(ValidFieldTypes::TIME);
00194 }
00195
00199 void clearTime()
00200 {
00201 this->time_ = 0;
00202 this->valid_fields_ &= ~ValidFieldTypes::TIME;
00203 }
00204
00210 void setPositions(industrial::joint_data::JointData &positions)
00211 {
00212 this->positions_.copyFrom(positions);
00213 this->valid_fields_ |= ValidFieldTypes::POSITION;
00214 }
00215
00222 bool getPositions(industrial::joint_data::JointData &dest)
00223 {
00224 dest.copyFrom(this->positions_);
00225 return is_valid(ValidFieldTypes::POSITION);
00226 }
00227
00231 void clearPositions()
00232 {
00233 this->positions_.init();
00234 this->valid_fields_ &= ~ValidFieldTypes::POSITION;
00235 }
00236
00242 void setVelocities(industrial::joint_data::JointData &velocities)
00243 {
00244 this->velocities_.copyFrom(velocities);
00245 this->valid_fields_ |= ValidFieldTypes::VELOCITY;
00246 }
00247
00254 bool getVelocities(industrial::joint_data::JointData &dest)
00255 {
00256 dest.copyFrom(this->velocities_);
00257 return is_valid(ValidFieldTypes::VELOCITY);
00258 }
00259
00263 void clearVelocities()
00264 {
00265 this->velocities_.init();
00266 this->valid_fields_ &= ~ValidFieldTypes::VELOCITY;
00267 }
00273 void setAccelerations(industrial::joint_data::JointData &accelerations)
00274 {
00275 this->accelerations_.copyFrom(accelerations);
00276 this->valid_fields_ |= ValidFieldTypes::ACCELERATION;
00277 }
00278
00285 bool getAccelerations(industrial::joint_data::JointData &dest)
00286 {
00287 dest.copyFrom(this->accelerations_);
00288 return is_valid(ValidFieldTypes::ACCELERATION);
00289 }
00290
00294 void clearAccelerations()
00295 {
00296 this->accelerations_.init();
00297 this->valid_fields_ &= ~ValidFieldTypes::ACCELERATION;
00298 }
00299
00300
00306 void copyFrom(JointTrajPtFull &src);
00307
00313 bool operator==(JointTrajPtFull &rhs);
00314
00320 bool is_valid(ValidFieldType field)
00321 {
00322 return valid_fields_ & field;
00323 }
00324
00325
00326 bool load(industrial::byte_array::ByteArray *buffer);
00327 bool unload(industrial::byte_array::ByteArray *buffer);
00328 unsigned int byteLength()
00329 {
00330 return 3*sizeof(industrial::shared_types::shared_int) + sizeof(industrial::shared_types::shared_real)
00331 + 3*this->positions_.byteLength();
00332 }
00333
00334 private:
00335
00339 industrial::shared_types::shared_int robot_id_;
00343 industrial::shared_types::shared_int sequence_;
00348 industrial::shared_types::shared_int valid_fields_;
00353 industrial::shared_types::shared_real time_;
00354
00358 industrial::joint_data::JointData positions_;
00362 industrial::joint_data::JointData velocities_;
00365 industrial::joint_data::JointData accelerations_;
00366
00367 };
00368
00369 }
00370 }
00371
00372 #endif