Simox
2.3.74.0
|
Encapsulates a differential inverse kinematics for the virtual robot. More...
Public Member Functions | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | DifferentialIK (RobotNodeSetPtr rns, RobotNodePtr coordSystem=RobotNodePtr(), JacobiProvider::InverseJacobiMethod invJacMethod=eSVD, float invParam=0.0f) |
Initialize a Jacobian object. More... | |
virtual void | setGoal (const Eigen::Matrix4f &goal, SceneObjectPtr tcp=SceneObjectPtr(), IKSolver::CartesianSelection mode=IKSolver::All, float tolerancePosition=5.0f, float toleranceRotation=3.0f/180.0f *M_PI, bool performInitialization=true) |
Sets the target position for (one of) the tcp(s). More... | |
virtual void | setGoal (const Eigen::Vector3f &goal, SceneObjectPtr tcp=SceneObjectPtr(), IKSolver::CartesianSelection mode=IKSolver::Position, float tolerancePosition=5.0f, float toleranceRotation=3.0f/180.0f *M_PI, bool performInitialization=true) |
Sets the target position for (one of) the tcp(s). More... | |
virtual Eigen::MatrixXf | getJacobianMatrix (SceneObjectPtr tcp, IKSolver::CartesianSelection mode) |
Returns the Jacobian matrix for a given tcp. More... | |
Eigen::MatrixXf | getJacobianMatrix (SceneObjectPtr tcp) override |
virtual Eigen::MatrixXf | getJacobianMatrix (IKSolver::CartesianSelection mode) |
Eigen::MatrixXf | getJacobianMatrix () override |
Eigen::VectorXf | getError (float stepSize=1.0f) override |
void | updateError (Eigen::VectorXf &error, float stepSize=1.0f) |
virtual Eigen::MatrixXf | getPseudoInverseJacobianMatrix (SceneObjectPtr tcp, IKSolver::CartesianSelection mode=IKSolver::All) |
Returns the pseudo inverse of the Jacobian matrix for a given tcp of the robot. More... | |
virtual Eigen::MatrixXf | getPseudoInverseJacobianMatrix () |
virtual Eigen::MatrixXf | getPseudoInverseJacobianMatrix (IKSolver::CartesianSelection mode) |
void | updateJacobianMatrix (Eigen::MatrixXf &jac) |
void | updateJacobianMatrix (Eigen::MatrixXf &jac, SceneObjectPtr tcp, IKSolver::CartesianSelection mode) |
virtual Eigen::VectorXf | computeStep (float stepSize=1.0f) |
Compute a single IK step. More... | |
virtual bool | computeSteps (float stepSize, float minChange, int maxSteps) |
Computes the complete inverse kinematics. More... | |
virtual bool | solveIK (float stepSize=0.2f, float minChange=0.0f, int maxSteps=50) |
Computes the complete inverse kinematics. More... | |
virtual RobotNodePtr | getDefaultTCP () |
Returns the default tcp of the robot. More... | |
virtual float | getErrorPosition (SceneObjectPtr tcp=SceneObjectPtr()) |
Returns the translation error for a given tcp (i.e., the distance to the target). More... | |
virtual float | getErrorRotation (SceneObjectPtr tcp=SceneObjectPtr()) |
Returns the error metric for a given tcp (i.e., the angle between the target pose). More... | |
virtual void | checkImprovements (bool enable) |
void | convertModelScalingtoM (bool enable) |
void | setVerbose (bool enable) |
virtual float | getMeanErrorPosition () |
virtual void | updateDeltaToGoal (Eigen::VectorXf &delta, SceneObjectPtr tcp=SceneObjectPtr()) |
virtual void | updateDelta (Eigen::VectorXf &delta, const Eigen::Matrix4f ¤t, const Eigen::Matrix4f &goal, IKSolver::CartesianSelection mode=IKSolver::All) |
virtual Eigen::VectorXf | getDeltaToGoal (SceneObjectPtr tcp=SceneObjectPtr()) |
virtual Eigen::VectorXf | getDelta (const Eigen::Matrix4f ¤t, const Eigen::Matrix4f &goal, IKSolver::CartesianSelection mode=IKSolver::All) |
virtual void | setMaxPositionStep (float s) |
When considering large errors, the translational part can be cut to this length. Set to <= 0 to ignore cutting (standard) More... | |
bool | checkTolerances () override |
virtual void | initialize () |
void | print () override |
print Print current status of the IK solver More... | |
Public Member Functions inherited from VirtualRobot::JacobiProvider | |
JacobiProvider (RobotNodeSetPtr rns, InverseJacobiMethod invJacMethod=eSVD) | |
virtual | ~JacobiProvider () |
virtual Eigen::MatrixXd | getJacobianMatrixD () |
virtual Eigen::MatrixXd | getJacobianMatrixD (SceneObjectPtr tcp) |
virtual Eigen::MatrixXf | computePseudoInverseJacobianMatrix (const Eigen::MatrixXf &m, const Eigen::VectorXf regularization=Eigen::VectorXf()) const |
virtual Eigen::MatrixXd | computePseudoInverseJacobianMatrixD (const Eigen::MatrixXd &m, const Eigen::VectorXd regularization=Eigen::VectorXd()) const |
virtual Eigen::MatrixXf | computePseudoInverseJacobianMatrix (const Eigen::MatrixXf &m, float invParameter, const Eigen::VectorXf regularization=Eigen::VectorXf()) const |
virtual Eigen::MatrixXd | computePseudoInverseJacobianMatrixD (const Eigen::MatrixXd &m, double invParameter, const Eigen::VectorXd regularization=Eigen::VectorXd()) const |
virtual void | updatePseudoInverseJacobianMatrix (Eigen::MatrixXf &invJac, const Eigen::MatrixXf &m, float invParameter=0.0f, Eigen::VectorXf regularization=Eigen::VectorXf()) const |
virtual void | updatePseudoInverseJacobianMatrixD (Eigen::MatrixXd &invJac, const Eigen::MatrixXd &m, double invParameter=0.0, Eigen::VectorXd regularization=Eigen::VectorXd()) const |
virtual Eigen::MatrixXf | getPseudoInverseJacobianMatrix (const Eigen::VectorXf regularization=Eigen::VectorXf()) |
virtual Eigen::MatrixXd | getPseudoInverseJacobianMatrixD (const Eigen::VectorXd regularization=Eigen::VectorXd()) |
virtual Eigen::MatrixXf | getPseudoInverseJacobianMatrix (SceneObjectPtr tcp, const Eigen::VectorXf regularization=Eigen::VectorXf()) |
virtual Eigen::MatrixXd | getPseudoInverseJacobianMatrixD (SceneObjectPtr tcp, const Eigen::VectorXd regularization=Eigen::VectorXd()) |
virtual Eigen::VectorXf | getJacobiRegularization (IKSolver::CartesianSelection mode=IKSolver::All) |
VirtualRobot::RobotNodeSetPtr | getRobotNodeSet () |
bool | isInitialized () |
void | setJointWeights (const Eigen::VectorXf &jointWeights) |
float | getDampedSvdLambda () const |
void | setDampedSvdLambda (float value) |
float | getJacobiMMRegularization () const |
void | setJacobiMMRegularization (float value) |
float | getJacobiRadianRegularization () const |
void | setJacobiRadianRegularization (float value) |
Protected Member Functions | |
virtual void | setNRows () |
Protected Member Functions inherited from VirtualRobot::JacobiProvider | |
virtual void | updatePseudoInverseJacobianMatrixInternal (Eigen::MatrixXf &invJac, const Eigen::MatrixXf &m, float invParameter=0.0f) const |
virtual void | updatePseudoInverseJacobianMatrixDInternal (Eigen::MatrixXd &invJac, const Eigen::MatrixXd &m, double invParameter=0.0) const |
Protected Attributes | |
float | invParam |
std::vector< SceneObjectPtr > | tcp_set |
RobotNodePtr | coordSystem |
bool | checkImprovement |
Indicates if the jacobian steps must improve the result, otherwise the loop is canceld. More... | |
std::size_t | nRows |
std::size_t | nDoF |
std::map< SceneObjectPtr, Eigen::Matrix4f, std::less< SceneObjectPtr >, Eigen::aligned_allocator< std::pair< const SceneObjectPtr, Eigen::Matrix4f > > > | targets |
std::map< SceneObjectPtr, Eigen::MatrixXf, std::less< SceneObjectPtr >, Eigen::aligned_allocator< std::pair< const SceneObjectPtr, Eigen::MatrixXf > > > | partJacobians |
std::map< SceneObjectPtr, IKSolver::CartesianSelection > | modes |
std::map< SceneObjectPtr, float > | tolerancePosition |
std::map< SceneObjectPtr, float > | toleranceRotation |
bool | convertMMtoM |
std::vector< RobotNodePtr > | nodes |
std::map< RobotNodePtr, std::vector< RobotNodePtr > > | parents |
Eigen::VectorXf | currentError |
Eigen::MatrixXf | currentJacobian |
Eigen::MatrixXf | currentInvJacobian |
Eigen::Matrix4f | tmpDeltaOrientation |
Eigen::AngleAxis< float > | tmpDeltaAA |
Eigen::VectorXf | tmpUpdateErrorDelta |
Eigen::Vector3f | tmpUpdateErrorPosition |
Eigen::MatrixXf | tmpUpdateJacobianPosition |
Eigen::MatrixXf | tmpUpdateJacobianOrientation |
Eigen::VectorXf | tmpComputeStepTheta |
float | positionMaxStep |
bool | verbose |
Protected Attributes inherited from VirtualRobot::JacobiProvider | |
std::string | name |
RobotNodeSetPtr | rns |
InverseJacobiMethod | inverseMethod |
bool | initialized |
Eigen::VectorXf | jointWeights |
float | dampedSvdLambda |
float | jacobiMMRegularization |
float | jacobiRadianRegularization |
Additional Inherited Members | |
Public Types inherited from VirtualRobot::JacobiProvider | |
enum | InverseJacobiMethod { eSVD, eSVDDamped, eSVDDampedDynamic, eTranspose } |
Several methods are offered for inverting the Jacobi (i.e. building the Pseudoinverse) More... | |
Encapsulates a differential inverse kinematics for the virtual robot.
The aim of this class is to offer a convenient mechanism to solve the inverse kinematics of redundant robots. With this class it is possible to specify goals for multiple TCPs which will be be used simultaneously within the same optimization step. That way, the IK for two-armed manipulation can be solved where both arms share the same hip joint (see image). For each tcp, it is possible to select which components of the error vector should be optimized. One can restrict it to consider only the orientation, or only position, or even only the -component, for instance. Any node of the virtual robot can be selected chosen tcp. For instance, the robot hand can be targed to reach for a position while its elbow should be lifted to a certain hight (see images and examples)
Despite all higher-level functionality, the standard application can still be implemented very intuitively. Example for bimanual manipulation:
Example for lifted elbow:
VirtualRobot::DifferentialIK::DifferentialIK | ( | RobotNodeSetPtr | rns, |
RobotNodePtr | coordSystem = RobotNodePtr() , |
||
JacobiProvider::InverseJacobiMethod | invJacMethod = eSVD , |
||
float | invParam = 0.0f |
||
) |
Initialize a Jacobian object.
rns | The robotNodes (i.e., joints) for which the Jacobians should be calculated. |
coordSystem | The coordinate system in which the Jacobians are defined. By default the global coordinate system is used. |
invJacMethod | The method for inverting the Jacobian |
invParam | Only used when != 0.0f |
|
virtual |
Enable or disable the check for improvements during computeSteps loop. If enabled and the delta to the goal does not gets smaller, the loop is canceled. Standard: disabled
|
overridevirtual |
Implements VirtualRobot::JacobiProvider.
|
virtual |
Compute a single IK step.
stepSize | Controls the amount of error to be reduced in each step: |
|
virtual |
Computes the complete inverse kinematics.
stepSize | Controls the amount of error to be reduced in each step: |
maxSteps | Maximal numbers of steps. |
minChange | The minimal change in joint angles (euclidean distance in radians) |
void VirtualRobot::DifferentialIK::convertModelScalingtoM | ( | bool | enable | ) |
If enabled, the Jacobian is computed for [m] while assuming the kinematic definitions are given in [mm]. Standard: disabled
|
virtual |
Returns the default tcp of the robot.
|
virtual |
|
virtual |
Returns 6D workspace delta that is used for Jacobi calculation.
Returns 6D workspace delta that is used for Jacobi calculation.
|
overridevirtual |
Computes the complete error vector, considering all TCPs and goals.
Implements VirtualRobot::JacobiProvider.
|
virtual |
Returns the translation error for a given tcp (i.e., the distance to the target).
|
virtual |
Returns the error metric for a given tcp (i.e., the angle between the target pose).
|
virtual |
Returns the Jacobian matrix for a given tcp.
tcp | The tcp joint that should be considered. By default the tcp joint that is defined in rns in the constructor is used. |
mode | Allows to include only a subset of the Cartesian coordinates in the Jacobian (e.g., X|Y if the z-component is unimportant) |
Please note the convention used to describe the orientation: the scaled axis representation. Orientations in the target vector e (see the example below) have to be given as vectors parallel to the rotation axis. Their lengths have to be the rotation angle in radians. Given a target pose matrix and the actual tcp pose, the pseudo inverse Jacobian matrix can be used to compute the first Taylor expansion of the IK as follows:
All this is done within computeSteps(). For more information regarding the differential inverse kinematics, see this lecture.
|
overridevirtual |
Implements VirtualRobot::JacobiProvider.
|
virtual |
|
overridevirtual |
Computes the complete Jacobian that considers all defined TCPs and goal poses.
Implements VirtualRobot::JacobiProvider.
|
virtual |
Returns distance to goal. If multiple goals/TCPs are defined the mean distance is returned.
|
virtual |
Returns the pseudo inverse of the Jacobian matrix for a given tcp of the robot.
The pseudo inverse can be calculated from the Jacobian matrix using the following formula:
. Update: In order to improve stability, we are now using singular value decomposition (SVD).
|
virtual |
|
virtual |
|
virtual |
Initializes the internal data structures according to setGoal setup. Usually no need to call this method explicitly, unless performInitialization was not requested in setGoal.
|
overridevirtual |
print Print current status of the IK solver
Reimplemented from VirtualRobot::JacobiProvider.
|
virtual |
Sets the target position for (one of) the tcp(s).
goal | Target pose of the tcp. |
tcp | The tcp joint that should be considered. By default the tcp joint that is defined in rns in the constructor is used. |
mode | Allows to include only a subset of the Cartesian coordinates in the Jacobian (e.g., X|Y if the z-component is unimportant) |
tolerancePosition | The threshold when to accept a solution. |
toleranceRotation | The threshold when to accept a solution in radians. |
performInitialization | If multiple goals will be set, the internal initialization can be omitted in order to speed up the setup procedure (Ensure, to call initialize() after setting all goals). |
|
virtual |
Sets the target position for (one of) the tcp(s).
goal | Target position of the tcp. |
tcp | The tcp joints that should be considered. By default the tcp joint that is defined in rns in the constructor is used. |
mode | Allows to include only a subset of the Cartesian coordinates in the Jacobian (e.g., X|Y if the z-component is unimportant) |
tolerancePosition | The threshold when to accept a solution. |
toleranceRotation | The threshold when to accept a solution in radians. |
performInitialization | If multiple goals will be set, the internal initialization can be omitted in order to speed up the setup procedure (Ensure, to call initialize() after setting all goals). |
|
virtual |
When considering large errors, the translational part can be cut to this length. Set to <= 0 to ignore cutting (standard)
|
protectedvirtual |
void VirtualRobot::DifferentialIK::setVerbose | ( | bool | enable | ) |
|
virtual |
Computes the complete inverse kinematics.
stepSize | Controls the amount of error to be reduced in each step: |
maxSteps | Maximal numbers of steps. |
minChange | The minimal change in joint angles (euclidean distance in radians) |
|
virtual |
|
virtual |
Returns 6D workspace delta that is used for Jacobi calculation. Updates the currentDeltaToGoal vector
void VirtualRobot::DifferentialIK::updateError | ( | Eigen::VectorXf & | error, |
float | stepSize = 1.0f |
||
) |
void VirtualRobot::DifferentialIK::updateJacobianMatrix | ( | Eigen::MatrixXf & | jac | ) |
void VirtualRobot::DifferentialIK::updateJacobianMatrix | ( | Eigen::MatrixXf & | jac, |
SceneObjectPtr | tcp, | ||
IKSolver::CartesianSelection | mode | ||
) |
|
protected |
Indicates if the jacobian steps must improve the result, otherwise the loop is canceld.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |