SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
scl::CControllerMultiTask Class Reference

#include <CControllerMultiTask.hpp>

Inheritance diagram for scl::CControllerMultiTask:
Inheritance graph
[legend]
Collaboration diagram for scl::CControllerMultiTask:
Collaboration graph
[legend]

Public Member Functions

 CControllerMultiTask ()
 
virtual ~CControllerMultiTask ()
 
virtual sBool computeControlForces ()
 
virtual sBool computeDynamics ()
 
virtual sBool computeNonControlOperations ()
 
virtual const Eigen::VectorXd * getControlForces ()
 
virtual sBool init (SControllerBase *arg_data, scl::CDynamicsBase *arg_dynamics)
 
virtual sBool reset ()
 
bool addTask (const std::string &arg_task_name, CTaskBase *arg_task, const sUInt arg_level)
 
bool removeTask (const std::string &arg_task_name)
 
CTaskBasegetTask (const std::string &arg_name)
 
sUInt getNumTasks () const
 
sUInt getNumTasks (const std::string &arg_type) const
 
sBool activateTask (const std::string &arg_task_name)
 
sBool deactivateTask (const std::string &arg_task_name)
 
bool addNonControlTask (const std::string &arg_task_name, CNonControlTaskBase *arg_task)
 
bool removeNonControlTask (const std::string &arg_task_name)
 
CNonControlTaskBasegetNonControlTask (const std::string &arg_name)
 
sUInt getNumNonControlTasks () const
 
sBool activateNonControlTask (const std::string &arg_type)
 
sBool deactivateNonControlTask (const std::string &arg_type)
 
virtual sBool hasBeenInit ()
 

Public Attributes

CTaskBaseactive_task_
 

Protected Member Functions

bool computeRangeSpaces ()
 

Protected Attributes

SControllerMultiTaskdata_
 
CServo servo_
 
sutil::CMappedMultiLevelList
< std::string, CTaskBase * > 
tasks_
 
sUInt task_count_
 
sutil::CMappedList
< std::string,
CNonControlTaskBase * > 
tasks_non_ctrl_
 
sUInt task_non_ctrl_count_
 
sBool has_been_init_
 
CDynamicsBasedynamics_
 

Detailed Description

A generic task space controller:

Contains:

  1. A servo which computes torques for a set of tasks, and applies the torques after filtering them through the range spaces. (Uses the task-level null space decomposition for a multi-level task hierarchy [cite])
  2. Contains a set of tasks and their priorities. Tasks contain: (a) A task servo to compute torques (b) A task model to compute dynamics
  3. Contains a Joint space model for computing the robot's joint space dynamics

Suggested usage :

1000Hz : computeControlForces //This is a servo tick. {//Executes: computeControlForces(); computeTaskTorques(); }

50-100 Hz : computeDynamics //This is a model update {//Executes: computeModel(); computeTaskModels(); }

50-100Hz : computeNonControlTasks //This is a non-control update {//Executes: computeNonControlTasks(); }

Constructor & Destructor Documentation

scl::CControllerMultiTask::CControllerMultiTask ( )

Default constructor : just sets pointers to NULL

virtual scl::CControllerMultiTask::~CControllerMultiTask ( )
inlinevirtual

Default destructor : does nothing

Member Function Documentation

sBool scl::CControllerMultiTask::activateNonControlTask ( const std::string &  arg_task_name)

Activates a non control task

Enables a task within the controller

sBool scl::CControllerMultiTask::activateTask ( const std::string &  arg_task_name)

Enables a task within the controller

sBool scl::CControllerMultiTask::addNonControlTask ( const std::string &  arg_task_name,
CNonControlTaskBase arg_task 
)

Adds a task to the controller

sBool scl::CControllerMultiTask::addTask ( const std::string &  arg_task_name,
CTaskBase arg_task,
const sUInt  arg_level 
)

Adds a task to the controller with a priority level. Priority levels start at 0 (highest priority) > 1 > 2 ...

If a higher level than max is supplied, new levels are created.

sBool scl::CControllerMultiTask::computeControlForces ( )
virtual

Equal to task forces or generalized coordinate forces depending on the type of controller that implements this API

Implements scl::CControllerBase.

sBool scl::CControllerMultiTask::computeDynamics ( )
virtual

Computes the dynamic model : Mass, MassInv, centrifugal/coriolis, gravity

Implements scl::CControllerBase.

sBool scl::CControllerMultiTask::computeNonControlOperations ( )
virtual

Support for non control computations in the controller. Iterates over the mapped list of non-control tasks and executes them one by one.

Such tasks typically include detailed error checks, logging, communication etc. Add anything that doesn't require hard real-time and high-performance constratints.

Computes the non-control tasks : I/O etc..

Implements scl::CControllerBase.

sBool scl::CControllerMultiTask::computeRangeSpaces ( )
protected

Computes range spaces for all its tasks according to their priorities. Starts with task level i and goes down. NOTE : It must be called after tasks at level i-1 undergo a model update (because the null-spaces change).

sBool scl::CControllerMultiTask::deactivateNonControlTask ( const std::string &  arg_task_name)

Deactivates a task within the controller

Disables a control task within the controller

sBool scl::CControllerMultiTask::deactivateTask ( const std::string &  arg_task_name)

Disables a control task within the controller

virtual const Eigen::VectorXd* scl::CControllerMultiTask::getControlForces ( )
inlinevirtual

Returns the current control forces

CNonControlTaskBase * scl::CControllerMultiTask::getNonControlTask ( const std::string &  arg_name)

Returns the task by this name

sUInt scl::CControllerMultiTask::getNumNonControlTasks ( ) const
inline

Returns the number of tasks that this controller executes simultaneously

sUInt scl::CControllerMultiTask::getNumTasks ( ) const
inline

Returns the number of tasks that this controller executes simultaneously

sUInt scl::CControllerMultiTask::getNumTasks ( const std::string &  arg_type) const

Returns the number of tasks of a given type that this controller executes simultaneously

CTaskBase * scl::CControllerMultiTask::getTask ( const std::string &  arg_name)

Returns the task by this name

virtual sBool scl::CControllerBase::hasBeenInit ( )
inlinevirtualinherited

Whether the controller has been attached to a robot or not

Reimplemented in scl::CControllerGc.

sBool scl::CControllerMultiTask::init ( SControllerBase arg_data,
scl::CDynamicsBase arg_dynamics 
)
virtual

Whether the controller has been initialized to a particular robot

Implements scl::CControllerBase.

sBool scl::CControllerMultiTask::removeNonControlTask ( const std::string &  arg_task_name)

Removes a task from the controller. NOTE : This only removes the task from the controller. The data structure is still conserved in the Database (for possible use later).

sBool scl::CControllerMultiTask::removeTask ( const std::string &  arg_task_name)

Removes a task from the controller. NOTE : This only removes the task from the controller. The data structure is still conserved in the Database (for possible use later).

sBool scl::CControllerMultiTask::reset ( )
virtual

Resets to default. Can then re-initialize and reuse.

NOTE : This is a rather complicated thing to do.

Resetting the tasks can be done in two ways:

  1. Simply forget everything about every task. Then there isn't enough information to reconstruct the tasks after that since the CTaskBase* pointers point to some subclass which is lost.
  2. Individually reset each task. In this case, the reset tasks need to be seeded with their data structures again which is just as hard to do as (1).

For now we'll just do (1)

Implements scl::CControllerBase.

Member Data Documentation

CTaskBase* scl::CControllerMultiTask::active_task_

When only one task is to be executed Speeds up this special (but fairly common) case. Default behavior : Set to first added task.

SControllerMultiTask* scl::CControllerMultiTask::data_
protected

All the data for this task-space controller

CServo scl::CControllerMultiTask::servo_
protected

The servo reads the task data and computes gc torques to be applied

sUInt scl::CControllerMultiTask::task_count_
protected

The number of tasks

sUInt scl::CControllerMultiTask::task_non_ctrl_count_
protected

The number of tasks

sutil::CMappedMultiLevelList<std::string, CTaskBase*> scl::CControllerMultiTask::tasks_
protected

The list of tasks that this controller will execute Outer vector : Specifies all tasks at a priority level. Inner vector : Contains tasks

sutil::CMappedList<std::string, CNonControlTaskBase*> scl::CControllerMultiTask::tasks_non_ctrl_
protected

The list of tasks that this controller will execute


The documentation for this class was generated from the following files: