10 #ifndef CROCODDYL_MULTIBODY_ACTIONS_CONTACT_FWDDYN_HPP_
11 #define CROCODDYL_MULTIBODY_ACTIONS_CONTACT_FWDDYN_HPP_
15 #include "crocoddyl/core/actuation-base.hpp"
16 #include "crocoddyl/core/constraints/constraint-manager.hpp"
17 #include "crocoddyl/core/costs/cost-sum.hpp"
18 #include "crocoddyl/core/diff-action-base.hpp"
19 #include "crocoddyl/multibody/contacts/multiple-contacts.hpp"
20 #include "crocoddyl/multibody/data/contacts.hpp"
21 #include "crocoddyl/multibody/fwd.hpp"
22 #include "crocoddyl/multibody/states/multibody.hpp"
73 template <
typename _Scalar>
77 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
79 typedef _Scalar Scalar;
90 typedef typename MathBase::VectorXs VectorXs;
91 typedef typename MathBase::MatrixXs MatrixXs;
110 boost::shared_ptr<StateMultibody> state,
111 boost::shared_ptr<ActuationModelAbstract> actuation,
112 boost::shared_ptr<ContactModelMultiple> contacts,
113 boost::shared_ptr<CostModelSum> costs,
114 const Scalar JMinvJt_damping = Scalar(0.),
115 const bool enable_force =
false);
135 boost::shared_ptr<StateMultibody> state,
136 boost::shared_ptr<ActuationModelAbstract> actuation,
137 boost::shared_ptr<ContactModelMultiple> contacts,
138 boost::shared_ptr<CostModelSum> costs,
139 boost::shared_ptr<ConstraintModelManager> constraints,
140 const Scalar JMinvJt_damping = Scalar(0.),
141 const bool enable_force =
false);
154 const boost::shared_ptr<DifferentialActionDataAbstract>& data,
155 const Eigen::Ref<const VectorXs>& x,
const Eigen::Ref<const VectorXs>& u);
170 const boost::shared_ptr<DifferentialActionDataAbstract>& data,
171 const Eigen::Ref<const VectorXs>& x);
181 const boost::shared_ptr<DifferentialActionDataAbstract>& data,
182 const Eigen::Ref<const VectorXs>& x,
const Eigen::Ref<const VectorXs>& u);
196 const boost::shared_ptr<DifferentialActionDataAbstract>& data,
197 const Eigen::Ref<const VectorXs>& x);
204 virtual boost::shared_ptr<DifferentialActionDataAbstract>
createData();
211 const boost::shared_ptr<DifferentialActionDataAbstract>& data);
217 const boost::shared_ptr<DifferentialActionDataAbstract>& data,
218 Eigen::Ref<VectorXs> u,
const Eigen::Ref<const VectorXs>& x,
219 const std::size_t maxiter = 100,
const Scalar tol = Scalar(1e-9));
264 const boost::shared_ptr<CostModelSum>&
get_costs()
const;
301 virtual void print(std::ostream& os)
const;
311 boost::shared_ptr<ActuationModelAbstract> actuation_;
312 boost::shared_ptr<ContactModelMultiple> contacts_;
313 boost::shared_ptr<CostModelSum> costs_;
314 boost::shared_ptr<ConstraintModelManager> constraints_;
315 pinocchio::ModelTpl<Scalar>& pinocchio_;
318 Scalar JMinvJt_damping_;
324 template <
typename _Scalar>
327 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
328 typedef _Scalar Scalar;
334 typedef typename MathBase::VectorXs VectorXs;
335 typedef typename MathBase::MatrixXs MatrixXs;
337 template <
template <
typename Scalar>
class Model>
339 Model<Scalar>*
const model)
341 pinocchio(pinocchio::DataTpl<Scalar>(model->get_pinocchio())),
343 &pinocchio, model->get_actuation()->createData(),
344 boost::make_shared<JointDataAbstract>(
345 model->get_state(), model->get_actuation(), model->get_nu()),
346 model->get_contacts()->createData(&pinocchio)),
347 costs(model->get_costs()->createData(&multibody)),
348 Kinv(model->get_state()->get_nv() +
349 model->get_contacts()->get_nc_total(),
350 model->get_state()->get_nv() +
351 model->get_contacts()->get_nc_total()),
352 df_dx(model->get_contacts()->get_nc_total(),
353 model->get_state()->get_ndx()),
354 df_du(model->get_contacts()->get_nc_total(), model->get_nu()),
355 tmp_xstatic(model->get_state()->get_nx()),
356 tmp_Jstatic(model->get_state()->get_nv(),
357 model->get_nu() + model->get_contacts()->get_nc_total()) {
358 multibody.joint->dtau_du.diagonal().setOnes();
359 costs->shareMemory(
this);
360 if (model->get_constraints() !=
nullptr) {
361 constraints = model->get_constraints()->createData(&multibody);
362 constraints->shareMemory(
this);
367 tmp_xstatic.setZero();
368 tmp_Jstatic.setZero();
369 pinocchio.lambda_c.resize(model->get_contacts()->get_nc_total());
370 pinocchio.lambda_c.setZero();
373 pinocchio::DataTpl<Scalar> pinocchio;
375 boost::shared_ptr<CostDataSumTpl<Scalar> > costs;
376 boost::shared_ptr<ConstraintDataManagerTpl<Scalar> > constraints;
380 VectorXs tmp_xstatic;
381 MatrixXs tmp_Jstatic;
400 #include <crocoddyl/multibody/actions/contact-fwddyn.hxx>
Abstract class for the actuation-mapping model.
Abstract class for differential action model.
VectorXs g_ub_
Lower bound of the inequality constraints.
boost::shared_ptr< StateAbstract > state_
Model of the state.
std::size_t nu_
Control dimension.
VectorXs g_lb_
Lower bound of the inequality constraints.
State multibody representation.
MatrixXs Fx
Jacobian of the dynamics w.r.t. the state .
MatrixXs Fu
Jacobian of the dynamics w.r.t. the control .
MatrixXs Luu
Hessian of the cost w.r.t. the control .
VectorXs Lx
Jacobian of the cost w.r.t. the state .
MatrixXs Lxx
Hessian of the cost w.r.t. the state .
VectorXs Lu
Jacobian of the cost w.r.t. the control .
VectorXs xout
evolution state