#include <task_library.hpp>
Public Member Functions | |
virtual | ~TrajectoryTask () |
virtual Status | check (double const *param, double value) const |
Checks that dt_seconds is positive and calls PDTask. | |
virtual Status | check (Vector const *param, Vector const &value) const |
If initialized, checks the validity of trjgoal and calls PDTask::check(). | |
virtual void | dbg (std::ostream &os, std::string const &title, std::string const &prefix) const |
Protected Types | |
typedef PDTask::saturation_policy_t | saturation_policy_t |
Velocity saturation policy. | |
Protected Member Functions | |
TrajectoryTask (std::string const &name, saturation_policy_t saturation_policy) | |
Status | initTrajectoryTask (Vector const &initpos) |
Initializes the trajectory to be at the current position with zero velocity. | |
Status | computeTrajectoryCommand (Vector const &curpos, Vector const &curvel, Vector &command) |
Computes the command for following the trajectory. | |
Protected Attributes | |
TypeIOTGCursor * | cursor_ |
double | dt_seconds_ |
Vector | trjgoal_ |
Vector | maxacc_ |
Vector | qh_maxvel_ |
Uses a PD control law to follow a trajectory generated using the reflexxes_otg library,
Parameters inherited from PDTask (this list may be outdated):
Parameters added by this base class:
Subclasses should call initTrajectoryTask() from their init(), and computeTrajectoryCommand() from their computeCommand().
Definition at line 274 of file task_library.hpp.
typedef PDTask::saturation_policy_t opspace::TrajectoryTask::saturation_policy_t [protected] |
Velocity saturation policy.
Reimplemented from opspace::PDTask.
Definition at line 296 of file task_library.hpp.
opspace::TrajectoryTask::~TrajectoryTask | ( | ) | [virtual] |
opspace::TrajectoryTask::TrajectoryTask | ( | std::string const & | name, | |
saturation_policy_t | saturation_policy | |||
) | [protected] |
Definition at line 594 of file task_library.cpp.
References opspace::ParameterReflection::declareParameter(), dt_seconds_, maxacc_, opspace::PARAMETER_FLAG_NOLOG, and trjgoal_.
Status opspace::TrajectoryTask::check | ( | double const * | param, | |
double | value | |||
) | const [virtual] |
Checks that dt_seconds is positive and calls PDTask.
Reimplemented from opspace::ParameterReflection.
Definition at line 686 of file task_library.cpp.
References dt_seconds_.
Status opspace::TrajectoryTask::check | ( | Vector const * | param, | |
Vector const & | value | |||
) | const [virtual] |
If initialized, checks the validity of trjgoal and calls PDTask::check().
Reimplemented from opspace::PDTask.
Definition at line 696 of file task_library.cpp.
References opspace::PDTask::check(), cursor_, maxacc_, opspace::PDTask::maxvel_, opspace::TypeIOTGCursor::ndof_, qh_maxvel_, opspace::PDTask::SATURATION_NORM, opspace::PDTask::saturation_policy_, and trjgoal_.
void opspace::TrajectoryTask::dbg | ( | std::ostream & | os, | |
std::string const & | title, | |||
std::string const & | prefix | |||
) | const [virtual] |
Reimplemented from opspace::Task.
Definition at line 738 of file task_library.cpp.
References opspace::Task::actual_, cursor_, opspace::ParameterReflection::instance_name_, opspace::TypeIOTGCursor::position(), jspace::pretty_print(), and trjgoal_.
Status opspace::TrajectoryTask::initTrajectoryTask | ( | Vector const & | initpos | ) | [protected] |
Initializes the trajectory to be at the current position with zero velocity.
Also does some sanity checking and optional conversion of parameters. Similarly to PDTask::initPDTask(), single-dimensional parameters can get blown up to the right size, depending on the saturation policy.
Definition at line 613 of file task_library.cpp.
References cursor_, opspace::TypeIOTGCursor::dt_seconds_, dt_seconds_, jspace::Status::errstr, opspace::PDTask::initPDTask(), maxacc_, opspace::PDTask::maxvel_, jspace::Status::ok, opspace::TypeIOTGCursor::position(), qh_maxvel_, opspace::PDTask::SATURATION_NORM, opspace::PDTask::saturation_policy_, trjgoal_, and opspace::TypeIOTGCursor::velocity().
Referenced by opspace::JPosTrjTask::init(), and opspace::CartPosTrjTask::init().
Status opspace::TrajectoryTask::computeTrajectoryCommand | ( | Vector const & | curpos, | |
Vector const & | curvel, | |||
Vector & | command | |||
) | [protected] |
Computes the command for following the trajectory.
It advances the cursor by dt_seconds toward the trjgoal and servos to that position and velocity using PDTask::computePDCommand().
Definition at line 662 of file task_library.cpp.
References opspace::PDTask::computePDCommand(), cursor_, opspace::PDTask::goalpos_, opspace::PDTask::goalvel_, maxacc_, opspace::TypeIOTGCursor::next(), opspace::otg_errstr(), opspace::TypeIOTGCursor::position(), qh_maxvel_, trjgoal_, and opspace::TypeIOTGCursor::velocity().
Referenced by opspace::JPosTrjTask::update(), and opspace::CartPosTrjTask::update().
TypeIOTGCursor* opspace::TrajectoryTask::cursor_ [protected] |
Definition at line 318 of file task_library.hpp.
Referenced by check(), computeTrajectoryCommand(), dbg(), initTrajectoryTask(), and ~TrajectoryTask().
double opspace::TrajectoryTask::dt_seconds_ [protected] |
Definition at line 319 of file task_library.hpp.
Referenced by check(), initTrajectoryTask(), opspace::JPosTrjTask::quickSetup(), and TrajectoryTask().
Vector opspace::TrajectoryTask::trjgoal_ [protected] |
Definition at line 320 of file task_library.hpp.
Referenced by check(), computeTrajectoryCommand(), dbg(), initTrajectoryTask(), and TrajectoryTask().
Vector opspace::TrajectoryTask::maxacc_ [protected] |
Definition at line 321 of file task_library.hpp.
Referenced by check(), computeTrajectoryCommand(), initTrajectoryTask(), opspace::JPosTrjTask::quickSetup(), and TrajectoryTask().
Vector opspace::TrajectoryTask::qh_maxvel_ [mutable, protected] |
Definition at line 322 of file task_library.hpp.
Referenced by check(), computeTrajectoryCommand(), and initTrajectoryTask().