opspace::PDTask Class Reference

Base class for tasks with proportional-derivative control. More...

#include <task_library.hpp>

Inheritance diagram for opspace::PDTask:

Inheritance graph
[legend]
Collaboration diagram for opspace::PDTask:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual Status check (Vector const *param, Vector const &value) const
 Verifies that kp, kd, and maxvel are non-negative.
void quickSetup (Vector const &kp, Vector const &kd, Vector const &maxvel)

Protected Types

enum  saturation_policy_t { SATURATION_OFF, SATURATION_COMPONENT_WISE, SATURATION_MAX_COMPONENT, SATURATION_NORM }
 Velocity saturation policy. More...

Protected Member Functions

 PDTask (std::string const &name, saturation_policy_t saturation_policy)
Status initPDTask (Vector const &initpos)
 Initialize the goalpos to initpos and the goalvel to zero.
Status computePDCommand (Vector const &curpos, Vector const &curvel, Vector &command)
 Compute PD command, with velocity saturation determined by the saturation_policy specified at construction time.

Protected Attributes

saturation_policy_t const saturation_policy_
bool initialized_
Vector goalpos_
Vector goalvel_
Vector errpos_
Vector errvel_
Vector kp_
Vector kd_
Vector maxvel_


Detailed Description

Base class for tasks with proportional-derivative control.

It provides a reusable implementation for the parameters and algorithm of a PD controller with velocity saturation.

Parameters:

Subclasses should call initPDTask() from within their init() method, and computePDCommand() from their computeCommand().

Definition at line 51 of file task_library.hpp.


Member Enumeration Documentation

enum opspace::PDTask::saturation_policy_t [protected]

Velocity saturation policy.

Enumerator:
SATURATION_OFF 
SATURATION_COMPONENT_WISE 
SATURATION_MAX_COMPONENT 
SATURATION_NORM 

Reimplemented in opspace::TrajectoryTask.

Definition at line 88 of file task_library.hpp.


Constructor & Destructor Documentation

opspace::PDTask::PDTask ( std::string const &  name,
saturation_policy_t  saturation_policy 
) [protected]

Definition at line 35 of file task_library.cpp.

References opspace::ParameterReflection::declareParameter(), errpos_, errvel_, goalpos_, goalvel_, kd_, kp_, maxvel_, and opspace::PARAMETER_FLAG_NOLOG.

Here is the call graph for this function:


Member Function Documentation

Status opspace::PDTask::check ( Vector const *  param,
Vector const &  value 
) const [virtual]

Verifies that kp, kd, and maxvel are non-negative.

If initialized, also verifies the vector dimension for kp, kd, maxvel, goalpos, and goalvel.

Returns:
Failure if any of the mentioned checks fail, and success otherwise.

Reimplemented from opspace::ParameterReflection.

Reimplemented in opspace::DraftPIDTask, and opspace::TrajectoryTask.

Definition at line 52 of file task_library.cpp.

References errpos_, errvel_, goalpos_, goalvel_, initialized_, kd_, kp_, maxvel_, SATURATION_NORM, and saturation_policy_.

Referenced by opspace::TrajectoryTask::check().

void opspace::PDTask::quickSetup ( Vector const &  kp,
Vector const &  kd,
Vector const &  maxvel 
) [inline]

Definition at line 65 of file task_library.hpp.

References kd_, kp_, and maxvel_.

Referenced by opspace::CartPosTask::quickSetup().

Status opspace::PDTask::initPDTask ( Vector const &  initpos  )  [protected]

Initialize the goalpos to initpos and the goalvel to zero.

Also performs sanity checks on kp, kd, and maxvel. If saturation policy is opspace::PDTask::SATURATION_NORM, then kp, kd, and maxvel must be single-dimensional. Otherwise, if they are single-dimensional, this method converts them to N-dimensional vectors by filling them with N copies of the value. E.g. if kp=[100.0] and initpos is 3-dimensional, kp would end up as [100.0, 100.0, 100.0].

Returns:
Success if everything went well, failure otherwise.

Definition at line 88 of file task_library.cpp.

References errpos_, errvel_, goalpos_, goalvel_, initialized_, kd_, kp_, maxvel_, SATURATION_NORM, and saturation_policy_.

Referenced by opspace::JPosTask::init(), opspace::CartPosTask::init(), opspace::DraftPIDTask::initDraftPIDTask(), and opspace::TrajectoryTask::initTrajectoryTask().

Status opspace::PDTask::computePDCommand ( Vector const &  curpos,
Vector const &  curvel,
Vector &  command 
) [protected]

Compute PD command, with velocity saturation determined by the saturation_policy specified at construction time.

This drives the task to achieving goalpos with goalvel.

Returns:
Success if everything went well, failure otherwise.

Definition at line 142 of file task_library.cpp.

References errpos_, jspace::Status::errstr, errvel_, goalpos_, goalvel_, initialized_, kd_, kp_, maxvel_, jspace::Status::ok, SATURATION_COMPONENT_WISE, SATURATION_MAX_COMPONENT, SATURATION_NORM, and saturation_policy_.

Referenced by opspace::DraftPIDTask::computeDraftPIDCommand(), opspace::TrajectoryTask::computeTrajectoryCommand(), opspace::JPosTask::update(), and opspace::CartPosTask::update().


Member Data Documentation

saturation_policy_t const opspace::PDTask::saturation_policy_ [protected]

Definition at line 122 of file task_library.hpp.

Referenced by opspace::TrajectoryTask::check(), check(), computePDCommand(), initPDTask(), and opspace::TrajectoryTask::initTrajectoryTask().

bool opspace::PDTask::initialized_ [protected]

Definition at line 123 of file task_library.hpp.

Referenced by opspace::DraftPIDTask::check(), check(), computePDCommand(), and initPDTask().

Vector opspace::PDTask::goalpos_ [protected]

Definition at line 124 of file task_library.hpp.

Referenced by opspace::DraftPIDTask::check(), check(), computePDCommand(), opspace::TrajectoryTask::computeTrajectoryCommand(), initPDTask(), and PDTask().

Vector opspace::PDTask::goalvel_ [protected]

Definition at line 125 of file task_library.hpp.

Referenced by check(), computePDCommand(), opspace::TrajectoryTask::computeTrajectoryCommand(), initPDTask(), and PDTask().

Vector opspace::PDTask::errpos_ [protected]

Definition at line 126 of file task_library.hpp.

Referenced by check(), opspace::DraftPIDTask::computeDraftPIDCommand(), computePDCommand(), opspace::DraftPIDTask::dbg(), initPDTask(), and PDTask().

Vector opspace::PDTask::errvel_ [protected]

Definition at line 127 of file task_library.hpp.

Referenced by check(), opspace::DraftPIDTask::computeDraftPIDCommand(), computePDCommand(), initPDTask(), and PDTask().

Vector opspace::PDTask::kp_ [protected]

Definition at line 128 of file task_library.hpp.

Referenced by check(), computePDCommand(), initPDTask(), PDTask(), opspace::JPosTrjTask::quickSetup(), and quickSetup().

Vector opspace::PDTask::kd_ [protected]

Definition at line 129 of file task_library.hpp.

Referenced by check(), computePDCommand(), initPDTask(), PDTask(), opspace::JPosTrjTask::quickSetup(), and quickSetup().

Vector opspace::PDTask::maxvel_ [protected]

Definition at line 130 of file task_library.hpp.

Referenced by opspace::TrajectoryTask::check(), check(), computePDCommand(), initPDTask(), opspace::TrajectoryTask::initTrajectoryTask(), PDTask(), opspace::JPosTrjTask::quickSetup(), and quickSetup().


The documentation for this class was generated from the following files:
Generated on Fri Aug 26 01:34:54 2011 for Stanford Whole-Body Control Framework by  doxygen 1.5.4