9 #ifndef CROCODDYL_MULTIBODY_CONTACTS_CONTACT_2D_HPP_
10 #define CROCODDYL_MULTIBODY_CONTACTS_CONTACT_2D_HPP_
12 #include <pinocchio/algorithm/frames.hpp>
13 #include <pinocchio/algorithm/kinematics-derivatives.hpp>
14 #include <pinocchio/multibody/data.hpp>
15 #include <pinocchio/spatial/motion.hpp>
17 #include "crocoddyl/core/utils/exception.hpp"
18 #include "crocoddyl/multibody/contact-base.hpp"
19 #include "crocoddyl/multibody/fwd.hpp"
23 template <
typename _Scalar>
26 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
28 typedef _Scalar Scalar;
34 typedef typename MathBase::Vector2s Vector2s;
35 typedef typename MathBase::Vector3s Vector3s;
36 typedef typename MathBase::VectorXs VectorXs;
37 typedef typename MathBase::Matrix3s Matrix3s;
49 const pinocchio::FrameIndex
id,
const Vector2s& xref,
51 const Vector2s& gains = Vector2s::Zero());
64 const pinocchio::FrameIndex
id,
const Vector2s& xref,
65 const Vector2s& gains = Vector2s::Zero());
75 virtual void calc(
const boost::shared_ptr<ContactDataAbstract>& data,
76 const Eigen::Ref<const VectorXs>& x);
85 virtual void calcDiff(
const boost::shared_ptr<ContactDataAbstract>& data,
86 const Eigen::Ref<const VectorXs>& x);
94 virtual void updateForce(
const boost::shared_ptr<ContactDataAbstract>& data,
95 const VectorXs& force);
101 pinocchio::DataTpl<Scalar>*
const data);
123 virtual void print(std::ostream& os)
const;
136 template <
typename _Scalar>
138 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
140 typedef _Scalar Scalar;
143 typedef typename MathBase::Matrix2s Matrix2s;
144 typedef typename MathBase::Matrix3s Matrix3s;
145 typedef typename MathBase::Matrix6xs Matrix6xs;
146 typedef typename MathBase::Vector3s Vector3s;
148 template <
template <
typename Scalar>
class Model>
150 pinocchio::DataTpl<Scalar>*
const data)
152 fJf(6, model->get_state()->get_nv()),
153 v_partial_dq(6, model->get_state()->get_nv()),
154 a_partial_dq(6, model->get_state()->get_nv()),
155 a_partial_dv(6, model->get_state()->get_nv()),
156 a_partial_da(6, model->get_state()->get_nv()),
157 fXjdv_dq(6, model->get_state()->get_nv()),
158 fXjda_dq(6, model->get_state()->get_nv()),
159 fXjda_dv(6, model->get_state()->get_nv()) {
160 frame = model->get_id();
161 jMf = model->get_state()->get_pinocchio()->frames[
frame].placement;
162 fXj =
jMf.inverse().toActionMatrix();
164 v_partial_dq.setZero();
165 a_partial_dq.setZero();
166 a_partial_dv.setZero();
167 a_partial_da.setZero();
189 pinocchio::MotionTpl<Scalar> v;
190 pinocchio::MotionTpl<Scalar> a;
192 Matrix6xs v_partial_dq;
193 Matrix6xs a_partial_dq;
194 Matrix6xs a_partial_dv;
195 Matrix6xs a_partial_da;
211 #include "crocoddyl/multibody/contacts/contact-2d.hxx"
State multibody representation.