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));
254 const boost::shared_ptr<CostModelSum>&
get_costs()
const;
291 virtual void print(std::ostream& os)
const;
301 boost::shared_ptr<ActuationModelAbstract> actuation_;
302 boost::shared_ptr<ContactModelMultiple> contacts_;
303 boost::shared_ptr<CostModelSum> costs_;
304 boost::shared_ptr<ConstraintModelManager> constraints_;
305 pinocchio::ModelTpl<Scalar>& pinocchio_;
308 Scalar JMinvJt_damping_;
314 template <
typename _Scalar>
317 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
318 typedef _Scalar Scalar;
324 typedef typename MathBase::VectorXs VectorXs;
325 typedef typename MathBase::MatrixXs MatrixXs;
327 template <
template <
typename Scalar>
class Model>
329 Model<Scalar>*
const model)
331 pinocchio(pinocchio::DataTpl<Scalar>(model->get_pinocchio())),
333 &pinocchio, model->get_actuation()->createData(),
334 boost::make_shared<JointDataAbstract>(
335 model->get_state(), model->get_actuation(), model->get_nu()),
336 model->get_contacts()->createData(&pinocchio)),
337 costs(model->get_costs()->createData(&multibody)),
338 Kinv(model->get_state()->get_nv() +
339 model->get_contacts()->get_nc_total(),
340 model->get_state()->get_nv() +
341 model->get_contacts()->get_nc_total()),
342 df_dx(model->get_contacts()->get_nc_total(),
343 model->get_state()->get_ndx()),
344 df_du(model->get_contacts()->get_nc_total(), model->get_nu()),
345 tmp_xstatic(model->get_state()->get_nx()),
346 tmp_Jstatic(model->get_state()->get_nv(),
347 model->get_nu() + model->get_contacts()->get_nc_total()) {
348 multibody.joint->dtau_du.diagonal().setOnes();
349 costs->shareMemory(
this);
350 if (model->get_constraints() !=
nullptr) {
351 constraints = model->get_constraints()->createData(&multibody);
352 constraints->shareMemory(
this);
357 tmp_xstatic.setZero();
358 tmp_Jstatic.setZero();
359 pinocchio.lambda_c.resize(model->get_contacts()->get_nc_total());
360 pinocchio.lambda_c.setZero();
363 pinocchio::DataTpl<Scalar> pinocchio;
365 boost::shared_ptr<CostDataSumTpl<Scalar> > costs;
366 boost::shared_ptr<ConstraintDataManagerTpl<Scalar> > constraints;
370 VectorXs tmp_xstatic;
371 MatrixXs tmp_Jstatic;
390 #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