|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Penalizes model/joint parameters that violate their configured limits. More...
#include <limit_error_function.h>
Public Member Functions | |
| LimitErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt, const ParameterLimits &pl=ParameterLimits(), const T &lossAlpha=GeneralizedLossT< T >::kL2, const T &lossC=T(1)) | |
| Constructor. | |
| LimitErrorFunctionT (const Character &character, const T &lossAlpha=GeneralizedLossT< T >::kL2, const T &lossC=T(1)) | |
| A convenience constructor where character contains info of the skeleton, parameter transform, and parameter limits. | |
| LimitErrorFunctionT (const Character &character, const ParameterLimits &pl, const T &lossAlpha=GeneralizedLossT< T >::kL2, const T &lossC=T(1)) | |
| A convenience constructor where character supplies the skeleton and parameter transform, with an explicit set of parameter limits. | |
| double | getError (const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState) final |
| double | getGradient (const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Ref< Eigen::VectorX< T > > gradient) final |
| double | getJacobian (const ModelParametersT< T > ¶ms, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Ref< Eigen::MatrixX< T > > jacobian, Ref< Eigen::VectorX< T > > residual, int &usedRows) final |
| size_t | getJacobianSize () const final |
| void | setLimits (const ParameterLimits &lm) |
| void | setLimits (const Character &character) |
| Public Member Functions inherited from momentum::SkeletonErrorFunctionT< T > | |
| SkeletonErrorFunctionT (const Skeleton &skel, const ParameterTransform &pt) | |
| virtual | ~SkeletonErrorFunctionT ()=default |
| const Skeleton & | getSkeleton () const |
| const ParameterTransform & | getParameterTransform () const |
| virtual const Character * | getCharacter () const |
| For mesh-based error functions, get access to the underlying character. | |
| void | setWeight (T w) |
| T | getWeight () const |
| void | setActiveJoints (const VectorX< bool > &aj) |
| void | setEnabledParameters (const ParameterSet &ps) |
| virtual double | getGradient (const ModelParametersT< T > &, const SkeletonStateT< T > &, const MeshStateT< T > &, Eigen::Ref< Eigen::VectorX< T > >) |
| virtual double | getJacobian (const ModelParametersT< T > &, const SkeletonStateT< T > &, const MeshStateT< T > &, Eigen::Ref< Eigen::MatrixX< T > >, Eigen::Ref< Eigen::VectorX< T > >, int &usedRows) |
| virtual void | getHessian (const ModelParametersT< T > &, const SkeletonStateT< T > &, const MeshStateT< T > &, Eigen::Ref< Eigen::MatrixX< T > >) |
| virtual double | getSolverDerivatives (const ModelParametersT< T > ¶meters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, const size_t actualParameters, Eigen::MatrixX< T > &hess, Eigen::VectorX< T > &grad) |
| virtual bool | needsMesh () const |
Additional Inherited Members | |
| Protected Attributes inherited from momentum::SkeletonErrorFunctionT< T > | |
| const Skeleton & | skeleton_ |
| const ParameterTransform & | parameterTransform_ |
| T | weight_ |
| VectorX< bool > | activeJointParams_ |
| ParameterSet | enabledParameters_ |
| bool | useHessian_ {false} |
Penalizes model/joint parameters that violate their configured limits.
Each limit contributes a squared residual (e.g., how far a parameter is past a min/max bound) that is transformed by the generalized loss function (see math/generalized_loss.h) before being weighted and accumulated. The default loss is L2 (alpha = 2, c = 1), which reproduces the classic quadratic penalty; other alpha values make the penalty robust to outliers.
Definition at line 25 of file limit_error_function.h.
| momentum::LimitErrorFunctionT< T >::LimitErrorFunctionT | ( | const Skeleton & | skel, |
| const ParameterTransform & | pt, | ||
| const ParameterLimits & | pl = ParameterLimits(), | ||
| const T & | lossAlpha = GeneralizedLossT<T>::kL2, | ||
| const T & | lossC = T(1) ) |
Constructor.
| [in] | skel | character skeleton |
| [in] | pt | character parameter transform |
| [in] | pl | parameter limits to enforce |
| [in] | lossAlpha | alpha (shape) parameter for the generalized loss function |
| [in] | lossC | c (scale) parameter for the generalized loss function |
Definition at line 790 of file limit_error_function.cpp.
References momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT().
Referenced by LimitErrorFunctionT(), and LimitErrorFunctionT().
|
explicit |
A convenience constructor where character contains info of the skeleton, parameter transform, and parameter limits.
| [in] | character | character definition |
| [in] | lossAlpha | alpha (shape) parameter for the generalized loss function |
| [in] | lossC | c (scale) parameter for the generalized loss function |
Definition at line 799 of file limit_error_function.cpp.
References LimitErrorFunctionT().
| momentum::LimitErrorFunctionT< T >::LimitErrorFunctionT | ( | const Character & | character, |
| const ParameterLimits & | pl, | ||
| const T & | lossAlpha = GeneralizedLossT<T>::kL2, | ||
| const T & | lossC = T(1) ) |
A convenience constructor where character supplies the skeleton and parameter transform, with an explicit set of parameter limits.
| [in] | character | character definition |
| [in] | pl | parameter limits to enforce |
| [in] | lossAlpha | alpha (shape) parameter for the generalized loss function |
| [in] | lossC | c (scale) parameter for the generalized loss function |
Definition at line 811 of file limit_error_function.cpp.
References LimitErrorFunctionT().
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 870 of file limit_error_function.cpp.
References momentum::SkeletonStateT< T >::jointParameters, momentum::kParametersPerJoint, MT_CHECK, and MT_PROFILE_FUNCTION.
|
final |
Definition at line 979 of file limit_error_function.cpp.
References MT_PROFILE_FUNCTION.
|
final |
Definition at line 1124 of file limit_error_function.cpp.
References MT_PROFILE_FUNCTION.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 1138 of file limit_error_function.cpp.
References momentum::Ellipsoid, momentum::HalfPlane, momentum::LimitTypeCount, momentum::Linear, momentum::LinearJoint, momentum::MinMax, momentum::MinMaxJoint, momentum::MinMaxJointPassive, and MT_THROW.
| void momentum::LimitErrorFunctionT< T >::setLimits | ( | const Character & | character | ) |
Definition at line 1169 of file limit_error_function.cpp.
References momentum::Character::parameterLimits.
| void momentum::LimitErrorFunctionT< T >::setLimits | ( | const ParameterLimits & | lm | ) |
Definition at line 1164 of file limit_error_function.cpp.