Robowflex
v0.1
Making MoveIt Easy
|
A Task Space Region (TSR). TSRs are workspace regions that impose a constraints on a robot. They are composed of a pose (in some reference frame) and tolerances on position and rotation. initialize() must be called once all parameters are set. More...
#include <tsr.h>
Classes | |
class | Specification |
The specification of a TSR. More... | |
Public Member Functions | |
Constructor and Initialization | |
TSR (const WorldPtr &world, const Specification &spec) | |
Constructor. More... | |
~TSR () | |
Destructor. Disables IK on node if created. More... | |
void | setWorld (const WorldPtr &world) |
Set the world used by this TSR. More... | |
void | clear () |
Clears the initialization of this TSR. More... | |
void | initialize () |
Initialize this TSR. Creates IK node attached to body node in world. More... | |
DoF Indexing | |
void | useGroup (const std::string &name) |
Use the joints in a robot's group. Robot used is the target frame's structure. More... | |
void | useIndices (const std::vector< std::size_t > &indices) |
Use DoF indices for TSR computation. More... | |
robowflex::RobotPose | getTransformToFrame () const |
Gets the transformation from the specification's base to the TSR's frame. More... | |
void | useWorldIndices (const std::vector< std::pair< std::size_t, std::size_t >> &indices) |
Use World DoF indices for TSR computation. World indices are pairs of skeleton index and DoF index. More... | |
void | setWorldIndices (const std::vector< std::pair< std::size_t, std::size_t >> &indices) |
Output world indices. TSR information for *WorldState methods uses this set of world indices. World indices are pairs of skeleton index and DoF index. More... | |
std::vector< std::pair< std::size_t, std::size_t > > | computeWorldIndices () const |
Compute the set of world indices used based on the underlying active indices. More... | |
std::size_t | getSkeletonIndex () |
Get the skeleton index for the target frame's structure. More... | |
const std::vector< std::size_t > & | getIndices () const |
Get the set of indices used for TSR computation. More... | |
const std::vector< std::pair< std::size_t, std::size_t > > & | getWorldIndices () const |
Get the set of output world indices used. More... | |
void | toBijection (Eigen::Ref< Eigen::VectorXd > world, const Eigen::Ref< const Eigen::VectorXd > &state) const |
From a configuration of controlled indices, map that configuration into a world configuration. That is, map state into world according to the set indices and world indices. More... | |
void | fromBijection (Eigen::Ref< Eigen::VectorXd > state, const Eigen::Ref< const Eigen::VectorXd > &world) const |
From a world configuration, map that configuration into a controlled DoF configuration. That is, map world into state according to the set indices and world indices. More... | |
Getters | |
std::size_t | getDimension () const |
Get the error dimension of this TSR. More... | |
std::size_t | getNumDofs () const |
Get the number of controlled DoF for this TSR. More... | |
std::size_t | getNumWorldDofs () const |
Get the number of world DoF for this TSR. More... | |
Specification and Updates | |
Specification & | getSpecification () |
Get the specification for this TSR. More... | |
void | updatePose () |
If the pose of the specification is updated, call this to update underlying IK solver. More... | |
void | updateBounds () |
If the bounds of the specification are updated, call this to update underlying IK solver. More... | |
void | updateSolver () |
If the solver parameters of the specification are updated, call this to update underlying IK solver. More... | |
Error / Function Computation | |
void | getErrorWorldRaw (Eigen::Ref< Eigen::VectorXd > error) const |
Get the current error given the world state, with all values. More... | |
void | getErrorWorld (Eigen::Ref< Eigen::VectorXd > error) const |
Get the current error given the world state. More... | |
void | getErrorWorldState (const Eigen::Ref< const Eigen::VectorXd > &world, Eigen::Ref< Eigen::VectorXd > error) const |
Get the error given a provided world configuration. More... | |
void | getError (const Eigen::Ref< const Eigen::VectorXd > &state, Eigen::Ref< Eigen::VectorXd > error) const |
Get the error given a configuration of the controlled DoF. More... | |
Jacobian Computation | |
void | getJacobianWorld (Eigen::Ref< Eigen::MatrixXd > jacobian) const |
Get the current Jacobian given the world state. More... | |
void | getJacobianWorldState (const Eigen::Ref< const Eigen::VectorXd > &world, Eigen::Ref< Eigen::MatrixXd > jacobian) const |
Get the Jacobian given a provided world configuration. More... | |
void | getJacobian (const Eigen::Ref< const Eigen::VectorXd > &state, Eigen::Ref< Eigen::MatrixXd > jacobian) const |
Get the Jacobian given a configuration of the controlled DoF. More... | |
Distance Computation | |
double | distanceWorld () const |
Get the current distance to satisfaction given the world state. More... | |
double | distanceWorldState (const Eigen::Ref< const Eigen::VectorXd > &world) const |
Get the distance to satisfaction given a provided world configuration. More... | |
double | distance (const Eigen::Ref< const Eigen::VectorXd > &state) const |
Get the distance to satisfaction given a configuration of the controlled DoF. More... | |
Solving for Satisfying Configurations | |
bool | solveWorld () |
Solve for a satisfying configuration given the current state of the world. More... | |
bool | solveWorldState (Eigen::Ref< Eigen::VectorXd > world) |
Solve for a satisfying configuration given an initial world configuration. More... | |
bool | solve (Eigen::Ref< Eigen::VectorXd > state) |
Solve for a satisfying configuration given an initial configuration of the controlled DoF. More... | |
bool | solveGradientWorld () |
Solve using gradient descent for a satisfying configuration given the current state of the world. More... | |
bool | solveGradientWorldState (Eigen::Ref< Eigen::VectorXd > world) |
Solve using gradient descent for a satisfying configuration given an initial world configuration. More... | |
bool | solveGradient (Eigen::Ref< Eigen::VectorXd > state) |
Solve using gradient descent for a satisfying configuration given an initial configuration of the controlled DoF. More... | |
Getting and Setting Position | |
void | setPositionsWorldState (const Eigen::Ref< const Eigen::VectorXd > &world) const |
Set the positions of the world given a world configuration. More... | |
void | setPositions (const Eigen::Ref< const Eigen::VectorXd > &state) const |
Set the positions of the world given a configuration. More... | |
void | getPositionsWorldState (Eigen::Ref< Eigen::VectorXd > world) const |
Get the positions of the world into a world configuration. More... | |
void | getPositions (Eigen::Ref< Eigen::VectorXd > state) const |
Get the positions of the world given into a configuration. More... | |
Private Member Functions | |
void | computeBijection () |
Compute the mapping from world indices to controlled DoF indices. More... | |
Private Attributes | |
WorldPtr | world_ |
Underlying world. More... | |
Specification | spec_ |
TSR specification. More... | |
std::size_t | skel_index_ |
Index of controlled skeleton. More... | |
std::vector< std::size_t > | indices_ |
Controlled indices. More... | |
std::vector< std::pair< std::size_t, std::size_t > > | world_indices_ |
World indices. More... | |
std::vector< std::size_t > | bijection_ |
std::shared_ptr< dart::dynamics::SimpleFrame > | frame_ {nullptr} |
Target frame of TSR. More... | |
dart::dynamics::BodyNode * | tnd_ {nullptr} |
Target body node. More... | |
std::shared_ptr< dart::dynamics::InverseKinematics > | ik_ {nullptr} |
Inverse kinematics module. More... | |
dart::dynamics::InverseKinematics::TaskSpaceRegion * | tsr_ {nullptr} |
TSR. More... | |
A Task Space Region (TSR). TSRs are workspace regions that impose a constraints on a robot. They are composed of a pose (in some reference frame) and tolerances on position and rotation. initialize() must be called once all parameters are set.
In the TSR, there are controlled DoF (through useIndices()) and world DoF (through useWorldIndices()). The controlled DoF are the DoF inside the structure the TSR's target frame is. These are the DoF that are used as part of the error, Jacobian, and other computations. However, the world might be using more DoF, especially if it is a multi-robot system. The world's DoF are given through useWorldIndices(). The *WorldState allow you to pass a configuration for the entire world (where each entry in that configuration corresponds to the indices given) and have the input / output be mapped appropriately to the controlled DoF.
Note, the TSR creates an IK node in the underlying Dart skeleton for the provided world. If you have multiple TSRs for the same target frame these will overwrite each other, unless you use a clone of the World.
TSR::TSR | ( | const WorldPtr & | world, |
const Specification & | spec | ||
) |
TSR::~TSR | ( | ) |
Destructor. Disables IK on node if created.
Definition at line 469 of file tsr.cpp.
void TSR::clear | ( | void | ) |
Clears the initialization of this TSR.
|
private |
Compute the mapping from world indices to controlled DoF indices.
Definition at line 897 of file tsr.cpp.
std::vector< std::pair< std::size_t, std::size_t > > TSR::computeWorldIndices | ( | ) | const |
double TSR::distance | ( | const Eigen::Ref< const Eigen::VectorXd > & | state | ) | const |
Get the distance to satisfaction given a configuration of the controlled DoF.
[in] | state | Controlled DoF configuration. |
Definition at line 685 of file tsr.cpp.
double TSR::distanceWorld | ( | ) | const |
Get the current distance to satisfaction given the world state.
Definition at line 671 of file tsr.cpp.
double TSR::distanceWorldState | ( | const Eigen::Ref< const Eigen::VectorXd > & | world | ) | const |
Get the distance to satisfaction given a provided world configuration.
[in] | world | World configuration (from world indices). |
Definition at line 678 of file tsr.cpp.
void TSR::fromBijection | ( | Eigen::Ref< Eigen::VectorXd > | state, |
const Eigen::Ref< const Eigen::VectorXd > & | world | ||
) | const |
std::size_t TSR::getDimension | ( | ) | const |
void TSR::getError | ( | const Eigen::Ref< const Eigen::VectorXd > & | state, |
Eigen::Ref< Eigen::VectorXd > | error | ||
) | const |
Get the error given a configuration of the controlled DoF.
[in] | state | Controlled DoF configuration. |
[out] | error | Error value. |
Definition at line 621 of file tsr.cpp.
void TSR::getErrorWorld | ( | Eigen::Ref< Eigen::VectorXd > | error | ) | const |
void TSR::getErrorWorldRaw | ( | Eigen::Ref< Eigen::VectorXd > | error | ) | const |
void TSR::getErrorWorldState | ( | const Eigen::Ref< const Eigen::VectorXd > & | world, |
Eigen::Ref< Eigen::VectorXd > | error | ||
) | const |
Get the error given a provided world configuration.
[in] | world | World configuration (from world indices). |
[out] | error | Error value. |
Definition at line 608 of file tsr.cpp.
const std::vector< std::size_t > & TSR::getIndices | ( | ) | const |
void TSR::getJacobian | ( | const Eigen::Ref< const Eigen::VectorXd > & | state, |
Eigen::Ref< Eigen::MatrixXd > | jacobian | ||
) | const |
Get the Jacobian given a configuration of the controlled DoF.
[in] | state | Controlled DoF configuration. |
[out] | jacobian | Jacobian value. |
Definition at line 662 of file tsr.cpp.
void TSR::getJacobianWorld | ( | Eigen::Ref< Eigen::MatrixXd > | jacobian | ) | const |
void TSR::getJacobianWorldState | ( | const Eigen::Ref< const Eigen::VectorXd > & | world, |
Eigen::Ref< Eigen::MatrixXd > | jacobian | ||
) | const |
Get the Jacobian given a provided world configuration.
[in] | world | World configuration (from world indices). |
[out] | jacobian | Jacobian value. |
Definition at line 643 of file tsr.cpp.
std::size_t TSR::getNumDofs | ( | ) | const |
std::size_t TSR::getNumWorldDofs | ( | ) | const |
void TSR::getPositions | ( | Eigen::Ref< Eigen::VectorXd > | state | ) | const |
void TSR::getPositionsWorldState | ( | Eigen::Ref< Eigen::VectorXd > | world | ) | const |
Get the positions of the world into a world configuration.
[out] | world | World configuration. |
Definition at line 796 of file tsr.cpp.
std::size_t TSR::getSkeletonIndex | ( | ) |
Get the skeleton index for the target frame's structure.
Definition at line 531 of file tsr.cpp.
TSR::Specification & TSR::getSpecification | ( | ) |
robowflex::RobotPose TSR::getTransformToFrame | ( | ) | const |
Gets the transformation from the specification's base to the TSR's frame.
const std::vector< std::pair< std::size_t, std::size_t > > & TSR::getWorldIndices | ( | ) | const |
Get the set of output world indices used.
void TSR::initialize | ( | ) |
Initialize this TSR. Creates IK node attached to body node in world.
Definition at line 839 of file tsr.cpp.
void TSR::setPositions | ( | const Eigen::Ref< const Eigen::VectorXd > & | state | ) | const |
void TSR::setPositionsWorldState | ( | const Eigen::Ref< const Eigen::VectorXd > & | world | ) | const |
void TSR::setWorld | ( | const WorldPtr & | world | ) |
void TSR::setWorldIndices | ( | const std::vector< std::pair< std::size_t, std::size_t >> & | indices | ) |
Output world indices. TSR information for *WorldState methods uses this set of world indices. World indices are pairs of skeleton index and DoF index.
[in] | indices | Indices to use. |
Definition at line 525 of file tsr.cpp.
bool TSR::solve | ( | Eigen::Ref< Eigen::VectorXd > | state | ) |
Solve for a satisfying configuration given an initial configuration of the controlled DoF.
[in] | state | Controlled DoF configuration. |
Definition at line 718 of file tsr.cpp.
bool TSR::solveGradient | ( | Eigen::Ref< Eigen::VectorXd > | state | ) |
Solve using gradient descent for a satisfying configuration given an initial configuration of the controlled DoF.
[in] | state | Controlled DoF configuration. |
bool TSR::solveGradientWorld | ( | ) |
Solve using gradient descent for a satisfying configuration given the current state of the world.
Definition at line 730 of file tsr.cpp.
bool TSR::solveGradientWorldState | ( | Eigen::Ref< Eigen::VectorXd > | world | ) |
bool TSR::solveWorld | ( | ) |
Solve for a satisfying configuration given the current state of the world.
bool TSR::solveWorldState | ( | Eigen::Ref< Eigen::VectorXd > | world | ) |
Solve for a satisfying configuration given an initial world configuration.
[in] | world | World configuration (from world indices). |
Definition at line 706 of file tsr.cpp.
void TSR::toBijection | ( | Eigen::Ref< Eigen::VectorXd > | world, |
const Eigen::Ref< const Eigen::VectorXd > & | state | ||
) | const |
void TSR::updateBounds | ( | ) |
If the bounds of the specification are updated, call this to update underlying IK solver.
Definition at line 821 of file tsr.cpp.
void TSR::updatePose | ( | ) |
void TSR::updateSolver | ( | ) |
void TSR::useGroup | ( | const std::string & | name | ) |
Use the joints in a robot's group. Robot used is the target frame's structure.
[in] | name | Name of group to use. |
Definition at line 492 of file tsr.cpp.
void TSR::useIndices | ( | const std::vector< std::size_t > & | indices | ) |
void TSR::useWorldIndices | ( | const std::vector< std::pair< std::size_t, std::size_t >> & | indices | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |