|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function that penalizes the jerk (third derivative) of joint positions across four consecutive frames using a standard finite difference stencil [1, -3, 3, -1]. More...
#include <jerk_sequence_error_function.h>
Public Member Functions | |
| JerkSequenceErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt) | |
| JerkSequenceErrorFunctionT (const Character &character) | |
| void | setTargetWeights (const Eigen::VectorX< T > &weights) |
| Set the per-joint weights for the jerk error. | |
| void | setTargetJerk (const Eigen::Vector3< T > &jerk) |
| Set a single target jerk applied to all joints. | |
| void | setTargetJerks (const std::vector< Eigen::Vector3< T > > &jerks) |
| Set per-joint target jerks. | |
| void | reset () |
| Reset weights to ones and target jerks to zero. | |
| const Eigen::VectorX< T > & | getTargetWeights () const |
| const std::vector< Eigen::Vector3< T > > & | getTargetJerks () const |
| Public Member Functions inherited from momentum::FiniteDifferenceSequenceErrorFunctionT< T > | |
| FiniteDifferenceSequenceErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt, const std::vector< T > &stencilCoefficients) | |
| FiniteDifferenceSequenceErrorFunctionT (const Character &character, const std::vector< T > &stencilCoefficients) | |
| 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 | setTargetWeights (const Eigen::VectorX< T > &weights) |
| Set the per-joint weights for the derivative error. | |
| void | setTargetValue (const Eigen::Vector3< T > &targetValue) |
| Set a single target value applied to all joints. | |
| void | setTargetValues (const std::vector< Eigen::Vector3< T > > &targetValues) |
| Set per-joint target values. | |
| void | reset () |
| Reset weights to ones and target values to zero. | |
| const Eigen::VectorX< T > & | getTargetWeights () const |
| const std::vector< Eigen::Vector3< T > > & | getTargetValues () const |
| const std::vector< T > & | getStencilCoefficients () 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 the jerk (third derivative) of joint positions across four consecutive frames using a standard finite difference stencil [1, -3, 3, -1].
The jerk residual for each joint is computed as: jerk = pos[t-1] - 3*pos[t] + 3*pos[t+1] - pos[t+2] - targetJerk
This is useful for enforcing smoothness in acceleration changes, which produces more natural-looking motion. By default, the target jerk is zero, which penalizes any non-zero jerk (smoothness constraint on acceleration).
Note: This error function only constrains position jerk, not rotation jerk, as rotation derivatives involve significantly more complex mathematics.
Definition at line 29 of file jerk_sequence_error_function.h.
| momentum::JerkSequenceErrorFunctionT< T >::JerkSequenceErrorFunctionT | ( | const Skeleton & | skel, |
| const ParameterTransform & | pt ) |
Definition at line 15 of file jerk_sequence_error_function.cpp.
References momentum::FiniteDifferenceSequenceErrorFunctionT< T >::FiniteDifferenceSequenceErrorFunctionT().
|
explicit |
Definition at line 21 of file jerk_sequence_error_function.cpp.
References momentum::FiniteDifferenceSequenceErrorFunctionT< T >::FiniteDifferenceSequenceErrorFunctionT().
|
inlinenodiscard |
Definition at line 61 of file jerk_sequence_error_function.h.
|
inlinenodiscard |
Definition at line 57 of file jerk_sequence_error_function.h.
|
inline |
Reset weights to ones and target jerks to zero.
Definition at line 53 of file jerk_sequence_error_function.h.
|
inline |
Set a single target jerk applied to all joints.
| jerk | The target jerk vector. |
Definition at line 42 of file jerk_sequence_error_function.h.
|
inline |
Set per-joint target jerks.
| jerks | Vector of target jerks, one per joint. |
Definition at line 48 of file jerk_sequence_error_function.h.
|
inline |
Set the per-joint weights for the jerk error.
| weights | Per-joint weights vector. Size must match the number of joints. |
Definition at line 36 of file jerk_sequence_error_function.h.