9 #ifndef CROCODDYL_MULTIBODY_COSTS_IMPULSE_COP_POSITION_HPP_ 10 #define CROCODDYL_MULTIBODY_COSTS_IMPULSE_COP_POSITION_HPP_ 12 #include "crocoddyl/multibody/fwd.hpp" 13 #include "crocoddyl/multibody/cost-base.hpp" 14 #include "crocoddyl/multibody/impulse-base.hpp" 15 #include "crocoddyl/multibody/impulses/impulse-3d.hpp" 16 #include "crocoddyl/multibody/impulses/impulse-6d.hpp" 17 #include "crocoddyl/multibody/data/impulses.hpp" 18 #include "crocoddyl/multibody/frames.hpp" 19 #include "crocoddyl/multibody/data/multibody.hpp" 20 #include "crocoddyl/core/activations/quadratic-barrier.hpp" 21 #include "crocoddyl/core/utils/exception.hpp" 25 template <
typename _Scalar>
28 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
30 typedef _Scalar Scalar;
41 typedef typename MathBase::Vector2s Vector2s;
42 typedef typename MathBase::Vector3s Vector3s;
43 typedef typename MathBase::VectorXs VectorXs;
44 typedef typename MathBase::MatrixXs MatrixXs;
45 typedef typename MathBase::MatrixX3s MatrixX3s;
46 typedef Eigen::Matrix<Scalar, 4, 6> Matrix46;
49 boost::shared_ptr<ActivationModelAbstract> activation,
50 const FrameCoPSupport& cop_support);
55 virtual void calc(
const boost::shared_ptr<CostDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
56 const Eigen::Ref<const VectorXs>& u);
58 virtual void calcDiff(
const boost::shared_ptr<CostDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
59 const Eigen::Ref<const VectorXs>& u);
61 virtual boost::shared_ptr<CostDataAbstract> createData(DataCollectorAbstract*
const data);
64 virtual void set_referenceImpl(
const std::type_info& ti,
const void* pv);
65 virtual void get_referenceImpl(
const std::type_info& ti,
void* pv)
const;
67 using Base::activation_;
73 FrameCoPSupport cop_support_;
76 template <
typename _Scalar>
78 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
80 typedef _Scalar Scalar;
86 typedef typename MathBase::Vector3s Vector3s;
87 typedef typename MathBase::VectorXs VectorXs;
88 typedef typename MathBase::MatrixXs MatrixXs;
89 typedef typename MathBase::Matrix3s Matrix3s;
90 typedef typename MathBase::Matrix6xs Matrix6xs;
91 typedef typename MathBase::Matrix6s Matrix6s;
92 typedef typename MathBase::Vector6s Vector6s;
94 template <
template <
typename Scalar>
class Model>
96 : Base(model, data), Arr_Ru(model->get_activation()->get_nr(), model->get_state()->get_nv()) {
102 throw_pretty(
"Invalid argument: the shared data should be derived from DataCollectorImpulse");
106 FrameCoPSupport cop_support = model->template get_reference<FrameCoPSupport>();
107 std::string frame_name = model->get_state()->get_pinocchio()->frames[cop_support.get_id()].name;
108 bool found_impulse =
false;
109 for (
typename ImpulseModelMultiple::ImpulseDataContainer::iterator it = d->impulses->impulses.begin();
110 it != d->impulses->impulses.end(); ++it) {
111 if (it->second->frame == cop_support.get_id()) {
114 throw_pretty(
"Domain error: a 6d impulse model is required in " + frame_name +
115 "in order to compute the CoP");
120 found_impulse =
true;
121 impulse = it->second;
126 if (!found_impulse) {
127 throw_pretty(
"Domain error: there isn't defined impulse data for " + frame_name);
131 pinocchio::DataTpl<Scalar>* pinocchio;
133 boost::shared_ptr<ImpulseDataAbstractTpl<Scalar> >
impulse;
134 using Base::activation;
152 #include "crocoddyl/multibody/costs/impulse-cop-position.hxx" 154 #endif // CROCODDYL_MULTIBODY_COSTS_IMPULSE_COP_POSITION_HPP_
boost::shared_ptr< ImpulseDataAbstractTpl< Scalar > > impulse
impulse force
Define a stack of impulse models.