#include <ActionModelIK.h>
Public Member Functions | |
ActionModelIK (RcsGraph *graph) | |
ActionModelIK (RcsGraph *graph, std::vector< Task *> tasks) | |
virtual | ~ActionModelIK () |
virtual void | reset () |
const ControllerBase * | getController () const |
RcsGraph * | getDesiredGraph () const |
void | setDesiredGraph (RcsGraph *newGraph) |
void | setupCollisionModel (const RcsCollisionMdl *modelToCopy) |
void | computeIK (MatNd *q_des, MatNd *q_dot_des, MatNd *T_des, const MatNd *x_des, double dt) |
void | computeIKVel (MatNd *q_des, MatNd *q_dot_des, MatNd *T_des, const MatNd *x_dot_des, double dt) |
![]() | |
ActionModel (RcsGraph *graph) | |
virtual | ~ActionModel () |
ActionModel * | clone () const |
virtual ActionModel * | clone (RcsGraph *newGraph) const =0 |
virtual void | computeCommand (MatNd *q_des, MatNd *q_dot_des, MatNd *T_des, const MatNd *action, double dt)=0 |
virtual void | getStableAction (MatNd *action) const =0 |
RcsGraph * | getGraph () |
void | setGraph (RcsGraph *newGraph) |
virtual ActionModel * | getWrappedActionModel () const |
const ActionModel * | unwrapAll () const |
ActionModel * | unwrapAll () |
template<typename AM > | |
const AM * | unwrap () const |
template<typename AM > | |
AM * | unwrap () |
![]() | |
BoxSpaceProvider () | |
virtual | ~BoxSpaceProvider () |
BoxSpaceProvider (const BoxSpaceProvider &)=delete | |
BoxSpaceProvider & | operator= (const BoxSpaceProvider &)=delete |
BoxSpaceProvider (BoxSpaceProvider &&)=delete | |
BoxSpaceProvider & | operator= (BoxSpaceProvider &&)=delete |
const BoxSpace * | getSpace () const |
virtual unsigned int | getDim () const =0 |
virtual void | getMinMax (double *min, double *max) const =0 |
virtual std::vector< std::string > | getNames () const |
Protected Member Functions | |
void | addTask (Task *task) |
void | addFixedTask (Task *task, MatNd *value) |
unsigned int | getNumActiveTasks () const |
void | ikFromDX (MatNd *q_des, MatNd *q_dot_des, double dt) const |
Protected Attributes | |
RcsGraph * | desiredGraph |
RcsCollisionMdl * | collisionMdl |
MatNd * | dx_des |
MatNd * | dH |
MatNd * | dq_ref |
![]() | |
RcsGraph * | graph |
Private Attributes | |
ControllerBase * | controller |
IkSolverRMR * | solver |
double | alpha = 1e-4 |
double | lambda = 1e-6 |
MatNd * | fixedTasksValues |
unsigned int | dimFixedTasks |
Friends | |
class | AMIKGeneric |
Base class for IK-based action models.
This class encapsulates a Rcs ControllerBase object as well as an inverse kinematics solver.
To use this, create a subclass and add your tasks in the constructor. Then, use computeIK(...) to invoke the solver.
In order to facilitate stable kinematics, the joint space error returned by the IK solver is integrated into the desired joint states ignoring the current measurements. To faciliate this, the ControllerBase object contains a copy of the main RcsGraph. Thus, all IK tasks should use this graph.
Definition at line 52 of file ActionModelIK.h.
|
explicit |
Create an empty IK-based action model. Tasks must be added to the controller before the first reset() call.
graph | current state graph |
Definition at line 122 of file ActionModelIK.cpp.
|
explicit |
Create an IK based action model using a fixed set of tasks.
graph | current state graph |
tasks | controller tasks to use |
Definition at line 144 of file ActionModelIK.cpp.
|
virtual |
Definition at line 154 of file ActionModelIK.cpp.
|
protected |
Add Rcs controller tasks that is always fixed to one target value. Do this after adding the regular tasks.
Definition at line 283 of file ActionModelIK.cpp.
|
protected |
Add a task to the controller. This works exactly as getController()->addTask() would. However, tasks may only be added before the first reset() call. Thus, getController() returns a const reference, and this method makes sure reset has not been called yet.
[in] | task | task to add. Takes ownership. |
Definition at line 165 of file ActionModelIK.cpp.
void Rcs::ActionModelIK::computeIK | ( | MatNd * | q_des, |
MatNd * | q_dot_des, | ||
MatNd * | T_des, | ||
const MatNd * | x_des, | ||
double | dt | ||
) |
Compute IK solution from desired task space state.
[out] | q_des | resulting desired joint positions |
[out] | q_dot_des | resulting desired joint velocities |
[out] | T_des | resulting desired joint torques |
[in] | x_des | desired task space state |
[in] | dt | time step since the last call |
Definition at line 191 of file ActionModelIK.cpp.
void Rcs::ActionModelIK::computeIKVel | ( | MatNd * | q_des, |
MatNd * | q_dot_des, | ||
MatNd * | T_des, | ||
const MatNd * | x_dot_des, | ||
double | dt | ||
) |
Compute IK solution from desired task space velocity.
[out] | q_des | resulting desired joint positions |
[out] | q_dot_des | resulting desired joint velocities |
[out] | T_des | resulting desired joint torques |
[in] | x_dot_des | desired task space velocity |
[in] | dt | time step since the last call |
Definition at line 200 of file ActionModelIK.cpp.
|
inline |
Exposes a const reference to the controller object. This is readonly since modifying the controller could break the solver.
Definition at line 76 of file ActionModelIK.h.
RcsGraph * Rcs::ActionModelIK::getDesiredGraph | ( | ) | const |
The graph holding the desired state of the IK solver.
Definition at line 262 of file ActionModelIK.cpp.
|
protected |
Definition at line 298 of file ActionModelIK.cpp.
|
protected |
Definition at line 210 of file ActionModelIK.cpp.
|
virtual |
Called at the start of a rollout to reset any state modified by computeCommand(). This allows to reuse the ActionModel for a new simulation rollout. The graph state will already be reset, so it can be used safely. It will be called before the first rollout too, so it can also be used to setup internals that depend on operations in subclass constructors.
Reimplemented from Rcs::ActionModel.
Reimplemented in Rcs::AMIKControllerActivation, and Rcs::AMPlateAngPos.
Definition at line 175 of file ActionModelIK.cpp.
void Rcs::ActionModelIK::setDesiredGraph | ( | RcsGraph * | newGraph | ) |
Definition at line 267 of file ActionModelIK.cpp.
void Rcs::ActionModelIK::setupCollisionModel | ( | const RcsCollisionMdl * | modelToCopy | ) |
Setup collision avoidance in the IK.
Will use a copy of the given collision model which operates on the desired graph.
modelToCopy | collision model to copy |
Definition at line 272 of file ActionModelIK.cpp.
|
friend |
Definition at line 141 of file ActionModelIK.h.
|
private |
Scaling factor for the nullspace gradient.
Definition at line 148 of file ActionModelIK.h.
|
protected |
Definition at line 129 of file ActionModelIK.h.
|
private |
Holder for the IK tasks (owned)
Definition at line 144 of file ActionModelIK.h.
|
protected |
Definition at line 126 of file ActionModelIK.h.
|
protected |
Definition at line 136 of file ActionModelIK.h.
|
private |
Store the cumulative number of task dimensions which are fixed to one target value.
Definition at line 154 of file ActionModelIK.h.
|
protected |
Definition at line 137 of file ActionModelIK.h.
|
protected |
Definition at line 135 of file ActionModelIK.h.
|
private |
Store the target values of all fixed tasks.
Definition at line 152 of file ActionModelIK.h.
|
private |
Regularization factor for the task space weighting.
Definition at line 150 of file ActionModelIK.h.
|
private |
IK solver (owned)
Definition at line 146 of file ActionModelIK.h.