10 #ifndef CROCODDYL_MULTIBODY_CONTACTS_MULTIPLE_CONTACTS_HPP_
11 #define CROCODDYL_MULTIBODY_CONTACTS_MULTIPLE_CONTACTS_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>
26 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
28 typedef _Scalar Scalar;
33 boost::shared_ptr<ContactModelAbstract> contact,
34 const bool active =
true)
35 : name(name), contact(contact), active(active) {}
42 os <<
"{" << *model.contact <<
"}";
47 boost::shared_ptr<ContactModelAbstract> contact;
59 template <
typename _Scalar>
62 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
64 typedef _Scalar Scalar;
73 typedef typename MathBase::Vector2s Vector2s;
74 typedef typename MathBase::Vector3s Vector3s;
75 typedef typename MathBase::VectorXs VectorXs;
76 typedef typename MathBase::MatrixXs MatrixXs;
78 typedef std::map<std::string, boost::shared_ptr<ContactItem> >
79 ContactModelContainer;
80 typedef std::map<std::string, boost::shared_ptr<ContactDataAbstract> >
82 typedef typename pinocchio::container::aligned_vector<
83 pinocchio::ForceTpl<Scalar> >::iterator ForceIterator;
92 const std::size_t nu);
112 boost::shared_ptr<ContactModelAbstract> contact,
113 const bool active =
true);
136 void calc(
const boost::shared_ptr<ContactDataMultiple>& data,
137 const Eigen::Ref<const VectorXs>& x);
145 void calcDiff(
const boost::shared_ptr<ContactDataMultiple>& data,
146 const Eigen::Ref<const VectorXs>& x);
156 const VectorXs& dv)
const;
165 void updateForce(
const boost::shared_ptr<ContactDataMultiple>& data,
166 const VectorXs& force);
178 const boost::shared_ptr<ContactDataMultiple>& data,
179 const MatrixXs& ddv_dx)
const;
193 const MatrixXs& df_dx,
const MatrixXs& df_du)
const;
206 pinocchio::DataTpl<Scalar>& pinocchio)
const;
215 pinocchio::DataTpl<Scalar>*
const data);
220 const boost::shared_ptr<StateMultibody>&
get_state()
const;
275 template <
class Scalar>
280 boost::shared_ptr<StateMultibody> state_;
281 ContactModelContainer contacts_;
283 std::size_t nc_total_;
285 std::set<std::string> active_set_;
286 std::set<std::string> inactive_set_;
287 bool compute_all_contacts_;
295 template <
typename _Scalar>
297 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
299 typedef _Scalar Scalar;
303 typedef typename MathBase::VectorXs VectorXs;
304 typedef typename MathBase::MatrixXs MatrixXs;
312 template <
template <
typename Scalar>
class Model>
314 pinocchio::DataTpl<Scalar>*
const data)
315 :
Jc(model->get_nc_total(), model->get_state()->get_nv()),
316 a0(model->get_nc_total()),
317 da0_dx(model->get_nc_total(), model->get_state()->get_ndx()),
318 dv(model->get_state()->get_nv()),
319 ddv_dx(model->get_state()->get_nv(), model->get_state()->get_ndx()),
320 fext(model->get_state()->get_pinocchio()->njoints,
321 pinocchio::ForceTpl<Scalar>::Zero()) {
327 for (
typename ContactModelMultiple::ContactModelContainer::const_iterator
328 it = model->get_contacts().begin();
329 it != model->get_contacts().end(); ++it) {
330 const boost::shared_ptr<ContactItem>& item = it->second;
332 std::make_pair(item->name, item->contact->createData(data)));
354 typename ContactModelMultiple::ContactDataContainer
356 pinocchio::container::aligned_vector<pinocchio::ForceTpl<Scalar> >
365 #include "crocoddyl/multibody/contacts/multiple-contacts.hxx"
State multibody representation.