Crocoddyl
 
Loading...
Searching...
No Matches
multibody.hpp
1
2// BSD 3-Clause License
3//
4// Copyright (C) 2019-2021, LAAS-CNRS, University of Edinburgh
5// Copyright note valid unless otherwise stated in individual files.
6// All rights reserved.
8
9#ifndef CROCODDYL_MULTIBODY_STATES_MULTIBODY_HPP_
10#define CROCODDYL_MULTIBODY_STATES_MULTIBODY_HPP_
11
12#include <pinocchio/multibody/model.hpp>
13
14#include "crocoddyl/core/state-base.hpp"
15#include "crocoddyl/multibody/fwd.hpp"
16
17namespace crocoddyl {
18
34template <typename _Scalar>
35class StateMultibodyTpl : public StateAbstractTpl<_Scalar> {
36 public:
37 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
38
39 typedef _Scalar Scalar;
42 typedef pinocchio::ModelTpl<Scalar> PinocchioModel;
43 typedef typename MathBase::VectorXs VectorXs;
44 typedef typename MathBase::MatrixXs MatrixXs;
45
51 explicit StateMultibodyTpl(std::shared_ptr<PinocchioModel> model);
53 virtual ~StateMultibodyTpl();
54
60 virtual VectorXs zero() const;
61
68 virtual VectorXs rand() const;
69
70 virtual void diff(const Eigen::Ref<const VectorXs>& x0,
71 const Eigen::Ref<const VectorXs>& x1,
72 Eigen::Ref<VectorXs> dxout) const;
73 virtual void integrate(const Eigen::Ref<const VectorXs>& x,
74 const Eigen::Ref<const VectorXs>& dx,
75 Eigen::Ref<VectorXs> xout) const;
76 virtual void Jdiff(const Eigen::Ref<const VectorXs>&,
77 const Eigen::Ref<const VectorXs>&,
78 Eigen::Ref<MatrixXs> Jfirst, Eigen::Ref<MatrixXs> Jsecond,
79 const Jcomponent firstsecond = both) const;
80
81 virtual void Jintegrate(const Eigen::Ref<const VectorXs>& x,
82 const Eigen::Ref<const VectorXs>& dx,
83 Eigen::Ref<MatrixXs> Jfirst,
84 Eigen::Ref<MatrixXs> Jsecond,
85 const Jcomponent firstsecond = both,
86 const AssignmentOp = setto) const;
87 virtual void JintegrateTransport(const Eigen::Ref<const VectorXs>& x,
88 const Eigen::Ref<const VectorXs>& dx,
89 Eigen::Ref<MatrixXs> Jin,
90 const Jcomponent firstsecond) const;
91
95 const std::shared_ptr<PinocchioModel>& get_pinocchio() const;
96
97 protected:
99 using Base::lb_;
100 using Base::ndx_;
101 using Base::nq_;
102 using Base::nv_;
103 using Base::nx_;
104 using Base::ub_;
105
106 private:
107 std::shared_ptr<PinocchioModel> pinocchio_;
108 VectorXs x0_;
109};
110
111} // namespace crocoddyl
112
113/* --- Details -------------------------------------------------------------- */
114/* --- Details -------------------------------------------------------------- */
115/* --- Details -------------------------------------------------------------- */
116#include "crocoddyl/multibody/states/multibody.hxx"
117
118#endif // CROCODDYL_MULTIBODY_STATES_MULTIBODY_HPP_
Abstract class for the state representation.
std::size_t nv_
Velocity dimension.
std::size_t nx_
State dimension.
bool has_limits_
Indicates whether any of the state limits is finite.
std::size_t nq_
Configuration dimension.
VectorXs lb_
Lower state limits.
VectorXs ub_
Upper state limits.
std::size_t ndx_
State rate dimension.
State multibody representation.
Definition multibody.hpp:35
StateMultibodyTpl(std::shared_ptr< PinocchioModel > model)
Initialize the multibody state.
virtual void integrate(const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &dx, Eigen::Ref< VectorXs > xout) const
Compute the state manifold integration.
virtual VectorXs zero() const
Generate a zero state.
const std::shared_ptr< PinocchioModel > & get_pinocchio() const
Return the Pinocchio model (i.e., model of the rigid body system)
virtual void diff(const Eigen::Ref< const VectorXs > &x0, const Eigen::Ref< const VectorXs > &x1, Eigen::Ref< VectorXs > dxout) const
Compute the state manifold differentiation.
virtual void Jintegrate(const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &dx, Eigen::Ref< MatrixXs > Jfirst, Eigen::Ref< MatrixXs > Jsecond, const Jcomponent firstsecond=both, const AssignmentOp=setto) const
Compute the Jacobian of the state manifold integration.
virtual VectorXs rand() const
Generate a random state.
virtual void JintegrateTransport(const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &dx, Eigen::Ref< MatrixXs > Jin, const Jcomponent firstsecond) const
Parallel transport from integrate(x, dx) to x.
virtual void Jdiff(const Eigen::Ref< const VectorXs > &, const Eigen::Ref< const VectorXs > &, Eigen::Ref< MatrixXs > Jfirst, Eigen::Ref< MatrixXs > Jsecond, const Jcomponent firstsecond=both) const
Compute the Jacobian of the state manifold differentiation.