Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
fully_differentiable_state_error_function.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
14
15#include <Eigen/Core>
16
17namespace momentum {
18
19template <typename T>
21 public StateErrorFunctionT<T> {
22 public:
27 default;
29 default;
31 FullyDifferentiableStateErrorFunctionT&&) noexcept = default;
32
33 [[nodiscard]] std::vector<std::string> inputs() const final;
34 [[nodiscard]] Eigen::Index getInputSize(const std::string& name) const final;
35 [[nodiscard]] const char* name() const final {
36 return "StateErrorFunction";
37 }
38
39 Eigen::VectorX<T> d_gradient_d_input_dot(
40 const std::string& inputName,
41 const ModelParametersT<T>& params,
42 const SkeletonStateT<T>& state,
43 Eigen::Ref<const Eigen::VectorX<T>> inputVec) final;
44
45 protected:
46 void getInputImp(const std::string& name, Eigen::Ref<Eigen::VectorX<T>> value) const final;
47 void setInputImp(const std::string& name, Eigen::Ref<const Eigen::VectorX<T>> value) final;
48
49 private:
50 template <typename JetType>
51 JetType calculateGradient_dot(
52 const SkeletonStateT<T>& state,
53 size_t iJoint,
54 const Eigen::Vector3<JetType>& targetTranslation,
55 const Eigen::Quaternion<JetType>& targetRotation,
56 const JetType& targetPositionWeight,
57 const JetType& targetRotationWeight,
58 Eigen::Ref<const Eigen::VectorX<T>> vec);
59};
60
61} // namespace momentum
std::vector< std::string > inputs() const final
void getInputImp(const std::string &name, Eigen::Ref< Eigen::VectorX< T > > value) const final
FullyDifferentiableStateErrorFunctionT(FullyDifferentiableStateErrorFunctionT &&) noexcept=default
FullyDifferentiableStateErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt)
FullyDifferentiableStateErrorFunctionT & operator=(const FullyDifferentiableStateErrorFunctionT &)=default
Eigen::VectorX< T > d_gradient_d_input_dot(const std::string &inputName, const ModelParametersT< T > &params, const SkeletonStateT< T > &state, Eigen::Ref< const Eigen::VectorX< T > > inputVec) final
FullyDifferentiableStateErrorFunctionT(const FullyDifferentiableStateErrorFunctionT &)=default
void setInputImp(const std::string &name, Eigen::Ref< const Eigen::VectorX< T > > value) final
Eigen::Index getInputSize(const std::string &name) const final
StateErrorFunctionT(const Skeleton &skel, const ParameterTransform &pt, RotationErrorType rotationErrorType=RotationErrorType::RotationMatrixDifference)
Definition types.h:28
SkeletonT< float > Skeleton
Definition fwd.h:263
ParameterTransformT< float > ParameterTransform
Definition fwd.h:244
A vector of size numModelParams holding the values of all model parameters for a character.
Definition types.h:99
Represents the complete state of a skeleton.