SCL
1.0
Standard Control Library : Control, dynamics, physics, and simulation
|
#include <CControllerMultiTask.hpp>
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) |
CTaskBase * | getTask (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) |
CNonControlTaskBase * | getNonControlTask (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 | |
CTaskBase * | active_task_ |
Protected Member Functions | |
bool | computeRangeSpaces () |
Protected Attributes | |
SControllerMultiTask * | data_ |
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_ |
CDynamicsBase * | dynamics_ |
A generic task space controller:
Contains:
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(); }
scl::CControllerMultiTask::CControllerMultiTask | ( | ) |
Default constructor : just sets pointers to NULL
|
inlinevirtual |
Default destructor : does nothing
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.
|
virtual |
Equal to task forces or generalized coordinate forces depending on the type of controller that implements this API
Implements scl::CControllerBase.
|
virtual |
Computes the dynamic model : Mass, MassInv, centrifugal/coriolis, gravity
Implements scl::CControllerBase.
|
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.
|
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
|
inlinevirtual |
Returns the current control forces
CNonControlTaskBase * scl::CControllerMultiTask::getNonControlTask | ( | const std::string & | arg_name | ) |
Returns the task by this name
|
inline |
Returns the number of tasks that this controller executes simultaneously
|
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
|
inlinevirtualinherited |
Whether the controller has been attached to a robot or not
Reimplemented in scl::CControllerGc.
|
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).
|
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:
For now we'll just do (1)
Implements scl::CControllerBase.
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.
|
protected |
All the data for this task-space controller
|
protected |
The servo reads the task data and computes gc torques to be applied
|
protected |
The number of tasks
|
protected |
The number of tasks
|
protected |
The list of tasks that this controller will execute Outer vector : Specifies all tasks at a priority level. Inner vector : Contains tasks
|
protected |
The list of tasks that this controller will execute