Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::StateSequenceErrorFunctionT< T > Class Template Reference

Error function that penalizes the difference between the current skeleton state and the next skeleton state. More...

#include <state_sequence_error_function.h>

Inheritance diagram for momentum::StateSequenceErrorFunctionT< T >:

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_

Detailed Description

template<typename T>
class momentum::StateSequenceErrorFunctionT< T >

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.

Constructor & Destructor Documentation

◆ StateSequenceErrorFunctionT() [1/2]

◆ StateSequenceErrorFunctionT() [2/2]

template<typename T>
momentum::StateSequenceErrorFunctionT< T >::StateSequenceErrorFunctionT ( const Character & character,
RotationErrorType rotationErrorType = RotationErrorType::RotationMatrixDifference )
explicit

Definition at line 474 of file state_sequence_error_function.cpp.

References StateSequenceErrorFunctionT().

Member Function Documentation

◆ getError()

◆ getGradient()

◆ getJacobian()

◆ getJacobianSize()

template<typename T>
size_t momentum::StateSequenceErrorFunctionT< T >::getJacobianSize ( ) const
nodiscardfinalvirtual

◆ getPositionWeight()

template<typename T>
const T & momentum::StateSequenceErrorFunctionT< T >::getPositionWeight ( ) const
inlinenodiscard

Definition at line 85 of file state_sequence_error_function.h.

◆ getPositionWeights()

template<typename T>
const Eigen::VectorX< T > & momentum::StateSequenceErrorFunctionT< T >::getPositionWeights ( ) const
inlinenodiscard

Definition at line 79 of file state_sequence_error_function.h.

◆ getRotationWeight()

template<typename T>
const T & momentum::StateSequenceErrorFunctionT< T >::getRotationWeight ( ) const
inlinenodiscard

Definition at line 88 of file state_sequence_error_function.h.

◆ getRotationWeights()

template<typename T>
const Eigen::VectorX< T > & momentum::StateSequenceErrorFunctionT< T >::getRotationWeights ( ) const
inlinenodiscard

Definition at line 82 of file state_sequence_error_function.h.

◆ numFrames()

template<typename T>
size_t momentum::StateSequenceErrorFunctionT< T >::numFrames ( ) const
inlinenodiscardfinalvirtual

◆ reset()

template<typename T>
void momentum::StateSequenceErrorFunctionT< T >::reset ( )

◆ setPositionTargetWeights()

template<typename T>
void momentum::StateSequenceErrorFunctionT< T >::setPositionTargetWeights ( const Eigen::VectorX< T > & posWeight)

Set the target position weights for each joint.

Parameters
posWeightPer-joint position weights.

Definition at line 503 of file state_sequence_error_function.cpp.

References MT_CHECK.

Referenced by setTargetWeights().

◆ setRotationTargetWeights()

template<typename T>
void momentum::StateSequenceErrorFunctionT< T >::setRotationTargetWeights ( const Eigen::VectorX< T > & rotWeight)

Set the target rotation weights for each joint.

Parameters
rotWeightPer-joint rotation weights.

Definition at line 509 of file state_sequence_error_function.cpp.

References MT_CHECK.

Referenced by setTargetWeights().

◆ setTargetState()

template<typename T>
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.

Parameters
targetA list of transforms representing the target state for each joint.

Definition at line 489 of file state_sequence_error_function.cpp.

References MT_CHECK.

◆ setTargetWeights()

template<typename T>
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.

Parameters
posWeightPer-joint position weights.
rotWeightPer-joint rotation weights.

Definition at line 495 of file state_sequence_error_function.cpp.

References setPositionTargetWeights(), and setRotationTargetWeights().

◆ setWeights()

template<typename T>
void momentum::StateSequenceErrorFunctionT< T >::setWeights ( const float posWeight,
const float rotationWeight )
inline

Definition at line 72 of file state_sequence_error_function.h.

Member Data Documentation

◆ kOrientationWeight

template<typename T>
T momentum::StateSequenceErrorFunctionT< T >::kOrientationWeight = 1e+0
staticconstexpr

Definition at line 114 of file state_sequence_error_function.h.

Referenced by getError(), getGradient(), and getJacobian().

◆ kPositionWeight

template<typename T>
T momentum::StateSequenceErrorFunctionT< T >::kPositionWeight = 1e-3
staticconstexpr

Definition at line 113 of file state_sequence_error_function.h.

Referenced by getError(), getGradient(), and getJacobian().


The documentation for this class was generated from the following files: