Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
position_error_function.cpp
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
9
11
12namespace momentum {
13
14template <typename T>
16 const size_t constrIndex,
17 const JointStateT<T>& state,
18 Vector3<T>& f,
19 std::array<Vector3<T>, 1>& v,
20 std::array<Matrix3<T>, 1>& dfdv) const {
22
23 const PositionDataT<T>& constr = this->constraints_[constrIndex];
24 v[0] = state.transform * constr.offset;
25 f = v[0] - constr.target;
26 dfdv[0].setIdentity();
27}
28
31
32} // namespace momentum
The PositionErrorFunction computes the 3D positional errors from a list of Constraints.
void evalFunction(size_t constrIndex, const JointStateT< T > &state, Vector3< T > &f, std::array< Vector3< T >, 1 > &v, std::array< Matrix3< T >, 1 > &dfdv) const final
Eigen::Matrix< T, 3, 3 > Matrix3
Definition types.h:96
Vector< T, 3 > Vector3
Definition types.h:236
Profiling macros that dispatch to one of three backends, selected at compile time:
#define MT_PROFILE_FUNCTION()
Definition profile.h:110
Represents the state of a joint with local and global transformations.
Definition joint_state.h:50
TransformT< T > transform
Global transformation in world space.
Definition joint_state.h:59
3D position constraint data
Vector3< T > offset
Positional offset in the parent joint space.
Vector3< T > target
Target position.