|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function that penalizes frame-to-frame changes in the relative transform between two joints. More...
#include <joint_to_joint_sequence_error_function.h>
Public Member Functions | |
| JointToJointSequenceErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt) | |
| JointToJointSequenceErrorFunctionT (const Character &character) | |
| size_t | numFrames () const final |
| double | getError (std::span< const ModelParametersT< T > > modelParameters, std::span< const SkeletonStateT< T > > skelStates, std::span< const MeshStateT< T > > meshStates) const final |
| double | getGradient (std::span< const ModelParametersT< T > > modelParameters, std::span< const SkeletonStateT< T > > skelStates, std::span< const MeshStateT< T > > meshStates, Eigen::Ref< Eigen::VectorX< T > > gradient) const final |
| double | getJacobian (std::span< const ModelParametersT< T > > modelParameters, std::span< const SkeletonStateT< T > > skelStates, std::span< const MeshStateT< T > > meshStates, Eigen::Ref< Eigen::MatrixX< T > > jacobian, Eigen::Ref< Eigen::VectorX< T > > residual, int &usedRows) const final |
| size_t | getJacobianSize () const final |
| void | addConstraint (const JointToJointSequenceConstraintT< T > &constraint) |
| Add a constraint using the struct. | |
| void | addConstraint (size_t sourceJoint, size_t referenceJoint, T weight=T(1), const std::string &name={}) |
| Add a constraint with individual parameters. | |
| void | clearConstraints () |
| Clear all constraints. | |
| const std::vector< JointToJointSequenceConstraintT< T > > & | getConstraints () const |
| Get all constraints. | |
| size_t | getNumConstraints () const |
| Returns the number of constraints. | |
| void | setPositionWeight (T w) |
| void | setOrientationWeight (T w) |
| T | getPositionWeight () const |
| T | getOrientationWeight () const |
| Public Member Functions inherited from momentum::SequenceErrorFunctionT< T > | |
| SequenceErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt) | |
| virtual | ~SequenceErrorFunctionT ()=default |
| void | setWeight (T w) |
| float | getWeight () const |
| void | setActiveJoints (const VectorX< bool > &aj) |
| void | setEnabledParameters (const ParameterSet &ps) |
| virtual bool | needsMesh () const |
| const Skeleton & | getSkeleton () const |
| const ParameterTransform & | getParameterTransform () const |
Additional Inherited Members | |
| Protected Attributes inherited from momentum::SequenceErrorFunctionT< T > | |
| const Skeleton & | skeleton_ |
| const ParameterTransform & | parameterTransform_ |
| T | weight_ = 1.0f |
| VectorX< bool > | activeJointParams_ |
| ParameterSet | enabledParameters_ |
Error function that penalizes frame-to-frame changes in the relative transform between two joints.
For each constraint with source joint A and reference joint B, computes the relative transform T_rel = T_B^{-1} * T_A at two consecutive frames. This expresses the source joint frame in the reference joint frame. It then penalizes changes in relative translation and relative rotation:
error = weight * ( positionWeight * ||T_rel_{i+1}.translation - T_rel_i.translation||^2
The source/reference direction is intentionally fixed; reversing the pair expresses the residual in the other joint's frame and can produce a different translation error when the relative orientation or reference scale changes.
| T | Scalar type (float or double) |
Definition at line 57 of file joint_to_joint_sequence_error_function.h.
| momentum::JointToJointSequenceErrorFunctionT< T >::JointToJointSequenceErrorFunctionT | ( | const Skeleton & | skel, |
| const ParameterTransform & | pt ) |
Definition at line 320 of file joint_to_joint_sequence_error_function.cpp.
References momentum::SequenceErrorFunctionT< T >::SequenceErrorFunctionT().
Referenced by JointToJointSequenceErrorFunctionT().
|
explicit |
Definition at line 326 of file joint_to_joint_sequence_error_function.cpp.
References JointToJointSequenceErrorFunctionT().
| void momentum::JointToJointSequenceErrorFunctionT< T >::addConstraint | ( | const JointToJointSequenceConstraintT< T > & | constraint | ) |
Add a constraint using the struct.
Definition at line 331 of file joint_to_joint_sequence_error_function.cpp.
References MT_CHECK, momentum::JointToJointSequenceConstraintT< T >::referenceJoint, and momentum::JointToJointSequenceConstraintT< T >::sourceJoint.
Referenced by addConstraint().
| void momentum::JointToJointSequenceErrorFunctionT< T >::addConstraint | ( | size_t | sourceJoint, |
| size_t | referenceJoint, | ||
| T | weight = T(1), | ||
| const std::string & | name = {} ) |
Add a constraint with individual parameters.
Definition at line 345 of file joint_to_joint_sequence_error_function.cpp.
References addConstraint(), momentum::JointToJointSequenceConstraintT< T >::name, momentum::JointToJointSequenceConstraintT< T >::referenceJoint, momentum::JointToJointSequenceConstraintT< T >::sourceJoint, and momentum::JointToJointSequenceConstraintT< T >::weight.
| void momentum::JointToJointSequenceErrorFunctionT< T >::clearConstraints | ( | ) |
Clear all constraints.
Definition at line 359 of file joint_to_joint_sequence_error_function.cpp.
|
inlinenodiscard |
Get all constraints.
Definition at line 101 of file joint_to_joint_sequence_error_function.h.
|
finalvirtual |
Reimplemented from momentum::SequenceErrorFunctionT< T >.
Definition at line 364 of file joint_to_joint_sequence_error_function.cpp.
References MT_CHECK, MT_PROFILE_FUNCTION, momentum::SequenceErrorFunctionT< T >::skeleton_, momentum::TransformT< T >::toRotationMatrix(), momentum::TransformT< T >::translation, and momentum::SequenceErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SequenceErrorFunctionT< T >.
Definition at line 397 of file joint_to_joint_sequence_error_function.cpp.
References momentum::SequenceErrorFunctionT< T >::activeJointParams_, MT_CHECK, MT_PROFILE_FUNCTION, momentum::SequenceErrorFunctionT< T >::parameterTransform_, momentum::SequenceErrorFunctionT< T >::skeleton_, momentum::TransformT< T >::toRotationMatrix(), momentum::TransformT< T >::translation, and momentum::SequenceErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SequenceErrorFunctionT< T >.
Definition at line 596 of file joint_to_joint_sequence_error_function.cpp.
References momentum::SequenceErrorFunctionT< T >::activeJointParams_, MT_CHECK, MT_PROFILE_FUNCTION, momentum::SequenceErrorFunctionT< T >::parameterTransform_, momentum::SequenceErrorFunctionT< T >::skeleton_, momentum::TransformT< T >::toRotationMatrix(), momentum::TransformT< T >::translation, and momentum::SequenceErrorFunctionT< T >::weight_.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SequenceErrorFunctionT< T >.
Definition at line 591 of file joint_to_joint_sequence_error_function.cpp.
|
inlinenodiscard |
Returns the number of constraints.
Definition at line 106 of file joint_to_joint_sequence_error_function.h.
|
inlinenodiscard |
Definition at line 120 of file joint_to_joint_sequence_error_function.h.
|
inlinenodiscard |
Definition at line 117 of file joint_to_joint_sequence_error_function.h.
|
inlinenodiscardfinalvirtual |
Implements momentum::SequenceErrorFunctionT< T >.
Definition at line 62 of file joint_to_joint_sequence_error_function.h.
|
inline |
Definition at line 113 of file joint_to_joint_sequence_error_function.h.
|
inline |
Definition at line 110 of file joint_to_joint_sequence_error_function.h.