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

Error function that penalizes differences in vertex velocity between source and target motion. More...

#include <vertex_sequence_error_function.h>

Inheritance diagram for momentum::VertexSequenceErrorFunctionT< T >:

Public Member Functions

 VertexSequenceErrorFunctionT (const Character &character)
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
bool needsMesh () const final
size_t getJacobianSize () const final
void addConstraint (int vertexIndex, T weight, const Eigen::Vector3< T > &targetVelocity)
 Add a vertex velocity constraint.
void clearConstraints ()
 Clear all vertex velocity constraints.
const std::vector< VertexVelocityConstraintT< T > > & getConstraints () const
 Get all vertex velocity constraints.
size_t getNumConstraints () const
 Get the number of constraints.
const Character & getCharacter () const
 Get the character reference.
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)
const Skeleton & getSkeleton () const
const ParameterTransform & getParameterTransform () const

Static Public Attributes

static constexpr T kVelocityWeight = 1e-3

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::VertexSequenceErrorFunctionT< T >

Error function that penalizes differences in vertex velocity between source and target motion.

This function computes vertex velocities by taking the difference between consecutive frames and penalizes deviations from target vertex velocities. It combines the sequence aspect of StateSequenceErrorFunction with vertex constraints from VertexErrorFunction.

Definition at line 40 of file vertex_sequence_error_function.h.

Constructor & Destructor Documentation

◆ VertexSequenceErrorFunctionT()

template<typename T>
momentum::VertexSequenceErrorFunctionT< T >::VertexSequenceErrorFunctionT ( const Character & character)
explicit

Member Function Documentation

◆ addConstraint()

template<typename T>
void momentum::VertexSequenceErrorFunctionT< T >::addConstraint ( int vertexIndex,
T weight,
const Eigen::Vector3< T > & targetVelocity )

Add a vertex velocity constraint.

Parameters
vertexIndexIndex of the vertex to constrain.
weightWeight for this constraint.
targetVelocityTarget velocity for the vertex.

Definition at line 42 of file vertex_sequence_error_function.cpp.

References MT_CHECK.

◆ clearConstraints()

template<typename T>
void momentum::VertexSequenceErrorFunctionT< T >::clearConstraints ( )

Clear all vertex velocity constraints.

Definition at line 37 of file vertex_sequence_error_function.cpp.

◆ getCharacter()

template<typename T>
const Character & momentum::VertexSequenceErrorFunctionT< T >::getCharacter ( ) const
inlinenodiscard

Get the character reference.

Definition at line 96 of file vertex_sequence_error_function.h.

◆ getConstraints()

template<typename T>
const std::vector< VertexVelocityConstraintT< T > > & momentum::VertexSequenceErrorFunctionT< T >::getConstraints ( ) const
inlinenodiscard

Get all vertex velocity constraints.

Definition at line 86 of file vertex_sequence_error_function.h.

◆ getError()

template<typename T>
double momentum::VertexSequenceErrorFunctionT< T >::getError ( std::span< const ModelParametersT< T > > modelParameters,
std::span< const SkeletonStateT< T > > skelStates,
std::span< const MeshStateT< T > > meshStates ) const
finalvirtual

◆ getGradient()

template<typename T>
double momentum::VertexSequenceErrorFunctionT< T >::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
finalvirtual

◆ getJacobian()

template<typename T>
double momentum::VertexSequenceErrorFunctionT< T >::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
finalvirtual

◆ getJacobianSize()

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

Reimplemented from momentum::SequenceErrorFunctionT< T >.

Definition at line 356 of file vertex_sequence_error_function.cpp.

◆ getNumConstraints()

template<typename T>
size_t momentum::VertexSequenceErrorFunctionT< T >::getNumConstraints ( ) const
inlinenodiscard

Get the number of constraints.

Definition at line 91 of file vertex_sequence_error_function.h.

◆ needsMesh()

template<typename T>
bool momentum::VertexSequenceErrorFunctionT< T >::needsMesh ( ) const
inlinenodiscardfinalvirtual

Reimplemented from momentum::SequenceErrorFunctionT< T >.

Definition at line 70 of file vertex_sequence_error_function.h.

◆ numFrames()

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

Member Data Documentation

◆ kVelocityWeight

template<typename T>
T momentum::VertexSequenceErrorFunctionT< T >::kVelocityWeight = 1e-3
staticconstexpr

Definition at line 100 of file vertex_sequence_error_function.h.

Referenced by getError().


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