10#ifndef CROCODDYL_MULTIBODY_RESIDUALS_FRAME_ROTATION_HPP_
11#define CROCODDYL_MULTIBODY_RESIDUALS_FRAME_ROTATION_HPP_
13#include "crocoddyl/core/residual-base.hpp"
14#include "crocoddyl/multibody/data/multibody.hpp"
15#include "crocoddyl/multibody/fwd.hpp"
16#include "crocoddyl/multibody/states/multibody.hpp"
35template <
typename _Scalar>
38 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41 typedef _Scalar Scalar;
48 typedef typename MathBase::VectorXs VectorXs;
49 typedef typename MathBase::Matrix3s Matrix3s;
60 const pinocchio::FrameIndex
id,
61 const Matrix3s& Rref,
const std::size_t nu);
73 const pinocchio::FrameIndex
id,
74 const Matrix3s& Rref);
84 virtual void calc(
const std::shared_ptr<ResidualDataAbstract>& data,
85 const Eigen::Ref<const VectorXs>& x,
86 const Eigen::Ref<const VectorXs>& u)
override;
95 virtual void calcDiff(
const std::shared_ptr<ResidualDataAbstract>& data,
96 const Eigen::Ref<const VectorXs>& x,
97 const Eigen::Ref<const VectorXs>& u)
override;
114 template <
typename NewScalar>
130 void set_id(
const pinocchio::FrameIndex
id);
142 virtual void print(std::ostream& os)
const override;
151 pinocchio::FrameIndex id_;
154 std::shared_ptr<typename StateMultibody::PinocchioModel>
158template <
typename _Scalar>
160 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
162 typedef _Scalar Scalar;
166 typedef typename MathBase::Vector3s Vector3s;
167 typedef typename MathBase::Matrix3s Matrix3s;
168 typedef typename MathBase::Matrix3xs Matrix3xs;
169 typedef typename MathBase::Matrix6xs Matrix6xs;
171 template <
template <
typename Scalar>
class Model>
174 :
Base(model, data),
rJf(3, 3),
fJf(6, model->get_state()->get_nv()) {
184 "Invalid argument: the shared data should be derived from "
185 "DataCollectorMultibody");
209#include "crocoddyl/multibody/residuals/frame-rotation.hxx"
211CROCODDYL_DECLARE_EXTERN_TEMPLATE_CLASS(
213CROCODDYL_DECLARE_EXTERN_TEMPLATE_STRUCT(
Abstract class for residual models.
std::shared_ptr< StateAbstract > state_
State description.
std::size_t nu_
Control dimension.
const Matrix3s & get_reference() const
Return the reference frame rotation.
void set_reference(const Matrix3s &reference)
Modify the reference frame rotation.
void set_id(const pinocchio::FrameIndex id)
Modify the reference frame id.
virtual void calcDiff(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
Compute the derivatives of the frame rotation residual.
ResidualModelFrameRotationTpl< NewScalar > cast() const
Cast the frame-rotation residual model to a different scalar type.
virtual std::shared_ptr< ResidualDataAbstract > createData(DataCollectorAbstract *const data) override
Create the frame rotation residual data.
pinocchio::FrameIndex get_id() const
Return the reference frame id.
ResidualModelFrameRotationTpl(std::shared_ptr< StateMultibody > state, const pinocchio::FrameIndex id, const Matrix3s &Rref)
Initialize the frame rotation residual model.
ResidualModelFrameRotationTpl(std::shared_ptr< StateMultibody > state, const pinocchio::FrameIndex id, const Matrix3s &Rref, const std::size_t nu)
Initialize the frame rotation residual model.
virtual void calc(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
Compute the frame rotation residual.
virtual void print(std::ostream &os) const override
Print relevant information of the frame-rotation residual.
State multibody representation.
MatrixXs Ru
Jacobian of the residual vector with respect the control.
MatrixXs Rx
Jacobian of the residual vector with respect the state.
DataCollectorAbstract * shared
Shared data allocated by the action model.
VectorXs r
Residual vector.
Matrix3s rRf
Rotation error of the frame.
Matrix3s rJf
Error Jacobian of the frame.
Matrix6xs fJf
Local Jacobian of the frame.
DataCollectorAbstract * shared
Shared data allocated by the action model.
VectorXs r
Residual vector.
pinocchio::DataTpl< Scalar > * pinocchio
Pinocchio data.