9 #ifndef CROCODDYL_MULTIBODY_COSTS_IMPULSE_WRENCH_CONE_HPP_ 10 #define CROCODDYL_MULTIBODY_COSTS_IMPULSE_WRENCH_CONE_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/wrench-cone.hpp" 20 #include "crocoddyl/core/utils/exception.hpp" 24 template <
typename _Scalar>
27 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
29 typedef _Scalar Scalar;
41 typedef typename MathBase::Vector6s Vector6s;
42 typedef typename MathBase::VectorXs VectorXs;
43 typedef typename MathBase::MatrixXs MatrixXs;
44 typedef typename MathBase::MatrixX3s MatrixX3s;
45 typedef typename MathBase::MatrixX6s MatrixX6s;
48 boost::shared_ptr<ActivationModelAbstract> activation,
const FrameWrenchCone& fref);
52 virtual void calc(
const boost::shared_ptr<CostDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
53 const Eigen::Ref<const VectorXs>& u);
54 virtual void calcDiff(
const boost::shared_ptr<CostDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
55 const Eigen::Ref<const VectorXs>& u);
56 virtual boost::shared_ptr<CostDataAbstract> createData(DataCollectorAbstract*
const data);
59 virtual void set_referenceImpl(
const std::type_info& ti,
const void* pv);
60 virtual void get_referenceImpl(
const std::type_info& ti,
void* pv)
const;
62 using Base::activation_;
67 FrameWrenchCone fref_;
70 template <
typename _Scalar>
72 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
74 typedef _Scalar Scalar;
80 typedef typename MathBase::VectorXs VectorXs;
81 typedef typename MathBase::MatrixXs MatrixXs;
82 typedef typename MathBase::Matrix6xs Matrix6xs;
84 template <
template <
typename Scalar>
class Model>
86 : Base(model, data), Arr_Rx(model->get_activation()->get_nr(), model->get_state()->get_ndx()) {
92 throw_pretty(
"Invalid argument: the shared data should be derived from DataCollectorImpulse");
96 FrameWrenchCone fref = model->template get_reference<FrameWrenchCone>();
97 std::string frame_name = model->get_state()->get_pinocchio()->frames[fref.id].name;
98 bool found_impulse =
false;
99 for (
typename ImpulseModelMultiple::ImpulseDataContainer::iterator it = d->impulses->impulses.begin();
100 it != d->impulses->impulses.end(); ++it) {
101 if (it->second->frame == fref.id) {
104 found_impulse =
true;
105 impulse = it->second;
106 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
110 found_impulse =
true;
111 impulse = it->second;
114 throw_pretty(
"Domain error: there isn't defined at least a 6d impulse for " + frame_name);
118 if (!found_impulse) {
119 throw_pretty(
"Domain error: there isn't defined impulse data for " + frame_name);
123 boost::shared_ptr<ImpulseDataAbstractTpl<Scalar> > impulse;
125 using Base::activation;
139 #include "crocoddyl/multibody/costs/impulse-wrench-cone.hxx" 141 #endif // CROCODDYL_MULTIBODY_COSTS_IMPULSE_WRENCH_CONE_HPP_
Define a stack of impulse models.