|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Error function that constrains the minimum vertex height to a target value. More...
#include <floor_error_function.h>
Public Member Functions | |
| FloorErrorFunctionT (const Character &character, std::vector< size_t > vertexIndices, T targetHeight=T(0), const Eigen::Vector3< T > &upDirection=Eigen::Vector3< T >::UnitY(), size_t k=5) | |
| Construct a floor error function. | |
| ~FloorErrorFunctionT () override | |
| FloorErrorFunctionT (const FloorErrorFunctionT &other)=delete | |
| FloorErrorFunctionT (FloorErrorFunctionT &&other) noexcept=delete | |
| FloorErrorFunctionT & | operator= (const FloorErrorFunctionT &other)=delete |
| FloorErrorFunctionT & | operator= (FloorErrorFunctionT &&other)=delete |
| double | getError (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState) final |
| double | getGradient (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::VectorX< T > > gradient) final |
| double | getJacobian (const ModelParametersT< T > &modelParameters, const SkeletonStateT< T > &state, const MeshStateT< T > &meshState, Eigen::Ref< Eigen::MatrixX< T > > jacobian, Eigen::Ref< Eigen::VectorX< T > > residual, int &usedRows) final |
| size_t | getJacobianSize () const final |
| void | setTargetHeight (T height) |
| Set the target height for the minimum vertices. | |
| T | getTargetHeight () const |
| Get the target height. | |
| void | setUpDirection (const Eigen::Vector3< T > &upDirection) |
| Set the up direction for height measurement. | |
| const Eigen::Vector3< T > & | getUpDirection () const |
| Get the up direction. | |
| void | setVertexIndices (std::vector< size_t > indices) |
| Set the candidate vertex indices. | |
| const std::vector< size_t > & | getVertexIndices () const |
| Get the candidate vertex indices. | |
| const Character * | getCharacter () const override |
| Get the character. | |
| bool | needsMesh () const override |
| This function requires the solver to provide a posed mesh. | |
| 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 |
| void | setWeight (T w) |
| T | getWeight () const |
| void | setActiveJoints (const VectorX< bool > &aj) |
| void | setEnabledParameters (const ParameterSet &ps) |
| 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) |
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} |
Error function that constrains the minimum vertex height to a target value.
Given a set of candidate vertex indices (e.g. foot vertices), this error function finds the k lowest vertices along a specified "up" direction and penalizes the difference between their average projection and a target height. This is useful for ground contact constraints where feet should touch the floor (target_height = 0) while allowing individual feet to lift off the ground.
Unlike HeightErrorFunction, this function:
Definition at line 35 of file floor_error_function.h.
|
explicit |
Construct a floor error function.
| character | The character (must have a mesh) |
| vertexIndices | Indices of candidate vertices to consider (e.g. foot vertices). The k lowest among these will be constrained. |
| targetHeight | Target height for the minimum vertices (default: 0) |
| upDirection | Direction to measure height along (default: Y-axis) |
| k | Number of lowest vertices to average (default: 5) |
Definition at line 26 of file floor_error_function.cpp.
References momentum::Character::mesh, MT_CHECK, and momentum::SkeletonErrorFunctionT< T >::SkeletonErrorFunctionT().
|
overridedefault |
|
delete |
|
deletenoexcept |
|
inlinenodiscardoverridevirtual |
Get the character.
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 106 of file floor_error_function.h.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 112 of file floor_error_function.cpp.
References MT_PROFILE_FUNCTION, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 125 of file floor_error_function.cpp.
References MT_PROFILE_FUNCTION, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
finalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 150 of file floor_error_function.cpp.
References MT_CHECK, MT_PROFILE_FUNCTION, and momentum::SkeletonErrorFunctionT< T >::weight_.
|
nodiscardfinalvirtual |
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 187 of file floor_error_function.cpp.
|
inlinenodiscard |
Get the target height.
Definition at line 83 of file floor_error_function.h.
|
inlinenodiscard |
Get the up direction.
Definition at line 93 of file floor_error_function.h.
|
inlinenodiscard |
Get the candidate vertex indices.
Definition at line 101 of file floor_error_function.h.
|
inlinenodiscardoverridevirtual |
This function requires the solver to provide a posed mesh.
Reimplemented from momentum::SkeletonErrorFunctionT< T >.
Definition at line 111 of file floor_error_function.h.
|
delete |
|
delete |
| void momentum::FloorErrorFunctionT< T >::setTargetHeight | ( | T | height | ) |
Set the target height for the minimum vertices.
Definition at line 47 of file floor_error_function.cpp.
| void momentum::FloorErrorFunctionT< T >::setUpDirection | ( | const Eigen::Vector3< T > & | upDirection | ) |
Set the up direction for height measurement.
| upDirection | The direction to measure height along (will be normalized) |
Definition at line 52 of file floor_error_function.cpp.
| void momentum::FloorErrorFunctionT< T >::setVertexIndices | ( | std::vector< size_t > | indices | ) |
Set the candidate vertex indices.
Definition at line 57 of file floor_error_function.cpp.
References MT_CHECK.