|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function that penalizes the acceleration of joint positions across three consecutive frames using a standard finite difference stencil [1, -2, 1]. More...
#include <acceleration_sequence_error_function.h>
Public Member Functions | |
| AccelerationSequenceErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt) | |
| AccelerationSequenceErrorFunctionT (const Character &character) | |
| void | setTargetWeights (const Eigen::VectorX< T > &weights) |
| Set the per-joint weights for the acceleration error. | |
| void | setTargetAcceleration (const Eigen::Vector3< T > &acceleration) |
| Set a single target acceleration applied to all joints. | |
| void | setTargetAccelerations (const std::vector< Eigen::Vector3< T > > &accelerations) |
| Set per-joint target accelerations. | |
| void | reset () |
| Reset weights to ones and target accelerations to zero. | |
| const Eigen::VectorX< T > & | getTargetWeights () const |
| const std::vector< Eigen::Vector3< T > > & | getTargetAccelerations () 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 acceleration of joint positions across three consecutive frames using a standard finite difference stencil [1, -2, 1].
The acceleration residual for each joint is computed as: accel = pos[t-1] - 2*pos[t] + pos[t+1] - targetAcceleration
This is useful for ballistic motion constraints where joints should follow a specific acceleration (e.g., gravity). By default, the target acceleration is zero, which penalizes any non-zero acceleration (smoothness constraint on velocity).
Note: This error function only constrains position acceleration, not rotation acceleration, as rotation acceleration involves significantly more complex mathematics.
Definition at line 29 of file acceleration_sequence_error_function.h.
| momentum::AccelerationSequenceErrorFunctionT< T >::AccelerationSequenceErrorFunctionT | ( | const Skeleton & | skel, |
| const ParameterTransform & | pt ) |
Definition at line 15 of file acceleration_sequence_error_function.cpp.
References momentum::FiniteDifferenceSequenceErrorFunctionT< T >::FiniteDifferenceSequenceErrorFunctionT().
|
explicit |
Definition at line 21 of file acceleration_sequence_error_function.cpp.
References momentum::FiniteDifferenceSequenceErrorFunctionT< T >::FiniteDifferenceSequenceErrorFunctionT().
|
inlinenodiscard |
Definition at line 62 of file acceleration_sequence_error_function.h.
|
inlinenodiscard |
Definition at line 58 of file acceleration_sequence_error_function.h.
|
inline |
Reset weights to ones and target accelerations to zero.
Definition at line 54 of file acceleration_sequence_error_function.h.
|
inline |
Set a single target acceleration applied to all joints.
This is a convenience method for uniform acceleration like gravity.
| acceleration | The target acceleration vector (e.g., (0, -9.8, 0) * dt^2 for gravity). |
Definition at line 43 of file acceleration_sequence_error_function.h.
|
inline |
Set per-joint target accelerations.
| accelerations | Vector of target accelerations, one per joint. |
Definition at line 49 of file acceleration_sequence_error_function.h.
|
inline |
Set the per-joint weights for the acceleration error.
| weights | Per-joint weights vector. Size must match the number of joints. |
Definition at line 36 of file acceleration_sequence_error_function.h.