|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function that penalizes the difference between the current skeleton state and the next skeleton state. More...
#include <state_sequence_error_function.h>
Public Member Functions | |
| StateSequenceErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt, RotationErrorType rotationErrorType=RotationErrorType::RotationMatrixDifference) | |
| StateSequenceErrorFunctionT (const Character &character, RotationErrorType rotationErrorType=RotationErrorType::RotationMatrixDifference) | |
| size_t | numFrames () const final |
| double | getError (std::span< const ModelParametersT< T > > modelParameters, std::span< const SkeletonStateT< T > > skelStates, std::span< const MeshStateT< T > >) const final |
| double | getGradient (std::span< const ModelParametersT< T > > modelParameters, std::span< const SkeletonStateT< T > > skelStates, std::span< const MeshStateT< T > >, 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 > >, Eigen::Ref< Eigen::MatrixX< T > > jacobian, Eigen::Ref< Eigen::VectorX< T > > residual, int &usedRows) const final |
| size_t | getJacobianSize () const final |
| void | setTargetWeights (const Eigen::VectorX< T > &posWeight, const Eigen::VectorX< T > &rotWeight) |
| Set the target weights for each joint's position and rotation. | |
| void | setPositionTargetWeights (const Eigen::VectorX< T > &posWeight) |
| Set the target position weights for each joint. | |
| void | setRotationTargetWeights (const Eigen::VectorX< T > &rotWeight) |
| Set the target rotation weights for each joint. | |
| void | setWeights (const float posWeight, const float rotationWeight) |
| void | reset () |
| const Eigen::VectorX< T > & | getPositionWeights () const |
| const Eigen::VectorX< T > & | getRotationWeights () const |
| const T & | getPositionWeight () const |
| const T & | getRotationWeight () const |
| void | setTargetState (TransformListT< T > target) |
| Set the target state for the skeleton. | |
| 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 |
Static Public Attributes | |
| static constexpr T | kPositionWeight = 1e-3 |
| static constexpr T | kOrientationWeight = 1e+0 |
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 the difference between the current skeleton state and the next skeleton state.
Note that by default this penalizes any difference between adjacent skeleton states. If we specify a target state, this will be applied as an offset to the current state, that is, the error will penalize the difference between offset * currentState and nextState.
Definition at line 22 of file state_sequence_error_function.h.
| momentum::StateSequenceErrorFunctionT< T >::StateSequenceErrorFunctionT | ( | const Skeleton & | skel, |
| const ParameterTransform & | pt, | ||
| RotationErrorType | rotationErrorType = RotationErrorType::RotationMatrixDifference ) |
Definition at line 462 of file state_sequence_error_function.cpp.
References momentum::SequenceErrorFunctionT< T >::SequenceErrorFunctionT(), and momentum::SequenceErrorFunctionT< T >::skeleton_.
Referenced by StateSequenceErrorFunctionT().
|
explicit |
Definition at line 474 of file state_sequence_error_function.cpp.
References StateSequenceErrorFunctionT().
|
finalvirtual |
Reimplemented from momentum::SequenceErrorFunctionT< T >.
Definition at line 515 of file state_sequence_error_function.cpp.
References kOrientationWeight, kPositionWeight, MT_CHECK, MT_PROFILE_FUNCTION, momentum::QuaternionLogMap, momentum::quaternionLogMap(), momentum::TransformT< T >::rotation, momentum::RotationMatrixDifference, momentum::SequenceErrorFunctionT< T >::skeleton_, momentum::TransformT< T >::translation, and momentum::SequenceErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SequenceErrorFunctionT< T >.
Definition at line 576 of file state_sequence_error_function.cpp.
References momentum::SequenceErrorFunctionT< T >::activeJointParams_, kOrientationWeight, kPositionWeight, MT_CHECK, MT_PROFILE_FUNCTION, momentum::SequenceErrorFunctionT< T >::parameterTransform_, momentum::QuaternionLogMap, momentum::quaternionLogMap(), momentum::quaternionLogMapDerivative(), momentum::TransformT< T >::rotation, momentum::RotationMatrixDifference, momentum::SequenceErrorFunctionT< T >::skeleton_, momentum::TransformT< T >::translation, and momentum::SequenceErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SequenceErrorFunctionT< T >.
Definition at line 692 of file state_sequence_error_function.cpp.
References momentum::SequenceErrorFunctionT< T >::activeJointParams_, kOrientationWeight, kPositionWeight, MT_CHECK, MT_PROFILE_FUNCTION, momentum::SequenceErrorFunctionT< T >::parameterTransform_, momentum::QuaternionLogMap, momentum::quaternionLogMap(), momentum::quaternionLogMapDerivative(), momentum::TransformT< T >::rotation, momentum::RotationMatrixDifference, momentum::SequenceErrorFunctionT< T >::skeleton_, momentum::TransformT< T >::translation, and momentum::SequenceErrorFunctionT< T >::weight_.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SequenceErrorFunctionT< T >.
Definition at line 679 of file state_sequence_error_function.cpp.
References momentum::QuaternionLogMap.
|
inlinenodiscard |
Definition at line 85 of file state_sequence_error_function.h.
|
inlinenodiscard |
Definition at line 79 of file state_sequence_error_function.h.
|
inlinenodiscard |
Definition at line 88 of file state_sequence_error_function.h.
|
inlinenodiscard |
Definition at line 82 of file state_sequence_error_function.h.
|
inlinenodiscardfinalvirtual |
Implements momentum::SequenceErrorFunctionT< T >.
Definition at line 32 of file state_sequence_error_function.h.
| void momentum::StateSequenceErrorFunctionT< T >::reset | ( | ) |
Definition at line 483 of file state_sequence_error_function.cpp.
References momentum::SequenceErrorFunctionT< T >::skeleton_.
| void momentum::StateSequenceErrorFunctionT< T >::setPositionTargetWeights | ( | const Eigen::VectorX< T > & | posWeight | ) |
Set the target position weights for each joint.
| posWeight | Per-joint position weights. |
Definition at line 503 of file state_sequence_error_function.cpp.
References MT_CHECK.
Referenced by setTargetWeights().
| void momentum::StateSequenceErrorFunctionT< T >::setRotationTargetWeights | ( | const Eigen::VectorX< T > & | rotWeight | ) |
Set the target rotation weights for each joint.
| rotWeight | Per-joint rotation weights. |
Definition at line 509 of file state_sequence_error_function.cpp.
References MT_CHECK.
Referenced by setTargetWeights().
| void momentum::StateSequenceErrorFunctionT< T >::setTargetState | ( | TransformListT< T > | target | ) |
Set the target state for the skeleton.
This function allows specifying a target state that the skeleton should aim to achieve. The target state is represented as a list of transforms, one for each joint. The error will penalize the difference between offset * currentState and nextState.
| target | A list of transforms representing the target state for each joint. |
Definition at line 489 of file state_sequence_error_function.cpp.
References MT_CHECK.
| void momentum::StateSequenceErrorFunctionT< T >::setTargetWeights | ( | const Eigen::VectorX< T > & | posWeight, |
| const Eigen::VectorX< T > & | rotWeight ) |
Set the target weights for each joint's position and rotation.
| posWeight | Per-joint position weights. |
| rotWeight | Per-joint rotation weights. |
Definition at line 495 of file state_sequence_error_function.cpp.
References setPositionTargetWeights(), and setRotationTargetWeights().
|
inline |
Definition at line 72 of file state_sequence_error_function.h.
|
staticconstexpr |
Definition at line 114 of file state_sequence_error_function.h.
Referenced by getError(), getGradient(), and getJacobian().
|
staticconstexpr |
Definition at line 113 of file state_sequence_error_function.h.
Referenced by getError(), getGradient(), and getJacobian().