10 #ifndef CROCODDYL_MULTIBODY_CONTACTS_CONTACT_1D_HPP_
11 #define CROCODDYL_MULTIBODY_CONTACTS_CONTACT_1D_HPP_
13 #include <pinocchio/algorithm/frames.hpp>
14 #include <pinocchio/algorithm/kinematics-derivatives.hpp>
15 #include <pinocchio/multibody/data.hpp>
16 #include <pinocchio/spatial/motion.hpp>
18 #include "crocoddyl/core/utils/exception.hpp"
19 #include "crocoddyl/multibody/contact-base.hpp"
20 #include "crocoddyl/multibody/fwd.hpp"
24 template <
typename _Scalar>
27 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
29 typedef _Scalar Scalar;
35 typedef typename MathBase::Vector2s Vector2s;
36 typedef typename MathBase::Vector3s Vector3s;
37 typedef typename MathBase::VectorXs VectorXs;
38 typedef typename MathBase::Matrix3s Matrix3s;
57 const pinocchio::FrameIndex
id,
const Scalar xref,
58 const pinocchio::ReferenceFrame type,
59 const Matrix3s& rotation,
const std::size_t nu,
60 const Vector2s& gains = Vector2s::Zero());
78 const pinocchio::FrameIndex
id,
const Scalar xref,
79 const pinocchio::ReferenceFrame type,
80 const Vector2s& gains = Vector2s::Zero());
83 "Use constructor that passes the type type of contact, this assumes is "
86 const pinocchio::FrameIndex
id,
const Scalar xref,
88 const Vector2s& gains = Vector2s::Zero());)
90 "Use constructor that passes the type type of contact, this assumes is "
93 const pinocchio::FrameIndex
id,
const Scalar xref,
94 const Vector2s& gains = Vector2s::Zero());)
104 virtual void calc(
const boost::shared_ptr<ContactDataAbstract>& data,
105 const Eigen::Ref<const VectorXs>& x);
114 virtual void calcDiff(
const boost::shared_ptr<ContactDataAbstract>& data,
115 const Eigen::Ref<const VectorXs>& x);
123 virtual void updateForce(
const boost::shared_ptr<ContactDataAbstract>& data,
124 const VectorXs& force);
130 pinocchio::DataTpl<Scalar>*
const data);
162 virtual void print(std::ostream& os)
const;
177 template <
typename _Scalar>
179 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
181 typedef _Scalar Scalar;
184 typedef typename MathBase::Matrix2s Matrix2s;
185 typedef typename MathBase::Matrix3s Matrix3s;
186 typedef typename MathBase::Matrix3xs Matrix3xs;
187 typedef typename MathBase::Matrix6xs Matrix6xs;
188 typedef typename MathBase::Vector3s Vector3s;
189 typedef typename pinocchio::MotionTpl<Scalar> Motion;
190 typedef typename pinocchio::ForceTpl<Scalar> Force;
192 template <
template <
typename Scalar>
class Model>
194 pinocchio::DataTpl<Scalar>*
const data)
197 f_local(Force::Zero()),
198 da0_local_dx(3, model->get_state()->get_ndx()),
199 fJf(6, model->get_state()->get_nv()),
200 v_partial_dq(6, model->get_state()->get_nv()),
201 a_partial_dq(6, model->get_state()->get_nv()),
202 a_partial_dv(6, model->get_state()->get_nv()),
203 a_partial_da(6, model->get_state()->get_nv()),
204 fXjdv_dq(6, model->get_state()->get_nv()),
205 fXjda_dq(6, model->get_state()->get_nv()),
206 fXjda_dv(6, model->get_state()->get_nv()),
207 fJf_df(3, model->get_state()->get_nv()) {
208 frame = model->get_id();
209 jMf = model->get_state()->get_pinocchio()->frames[
frame].placement;
210 fXj =
jMf.inverse().toActionMatrix();
214 da0_local_dx.setZero();
216 v_partial_dq.setZero();
217 a_partial_dq.setZero();
218 a_partial_dv.setZero();
219 a_partial_da.setZero();
223 a0_world_skew.setZero();
249 Matrix3xs da0_local_dx;
251 Matrix6xs v_partial_dq;
252 Matrix6xs a_partial_dq;
253 Matrix6xs a_partial_dv;
254 Matrix6xs a_partial_da;
258 Matrix3s a0_world_skew;
273 #include "crocoddyl/multibody/contacts/contact-1d.hxx"
State multibody representation.