9 #ifndef CROCODDYL_MULTIBODY_RESIDUALS_CONTACT_WRENCH_CONE_HPP_
10 #define CROCODDYL_MULTIBODY_RESIDUALS_CONTACT_WRENCH_CONE_HPP_
12 #include "crocoddyl/multibody/fwd.hpp"
13 #include "crocoddyl/core/residual-base.hpp"
14 #include "crocoddyl/multibody/states/multibody.hpp"
15 #include "crocoddyl/multibody/contact-base.hpp"
16 #include "crocoddyl/multibody/impulse-base.hpp"
17 #include "crocoddyl/multibody/contacts/multiple-contacts.hpp"
18 #include "crocoddyl/multibody/contacts/contact-3d.hpp"
19 #include "crocoddyl/multibody/contacts/contact-6d.hpp"
20 #include "crocoddyl/multibody/impulses/multiple-impulses.hpp"
21 #include "crocoddyl/multibody/impulses/impulse-3d.hpp"
22 #include "crocoddyl/multibody/impulses/impulse-6d.hpp"
23 #include "crocoddyl/multibody/data/contacts.hpp"
24 #include "crocoddyl/multibody/data/impulses.hpp"
25 #include "crocoddyl/multibody/wrench-cone.hpp"
26 #include "crocoddyl/core/utils/exception.hpp"
49 template <
typename _Scalar>
52 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
54 typedef _Scalar Scalar;
62 typedef typename MathBase::VectorXs VectorXs;
63 typedef typename MathBase::MatrixXs MatrixXs;
64 typedef typename MathBase::MatrixX6s MatrixX6s;
101 virtual void calc(
const boost::shared_ptr<ResidualDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
102 const Eigen::Ref<const VectorXs>& u);
113 virtual void calc(
const boost::shared_ptr<ResidualDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x);
126 virtual void calcDiff(
const boost::shared_ptr<ResidualDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
127 const Eigen::Ref<const VectorXs>& u);
138 virtual void calcDiff(
const boost::shared_ptr<ResidualDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x);
161 void set_id(
const pinocchio::FrameIndex
id);
173 virtual void print(std::ostream& os)
const;
181 pinocchio::FrameIndex id_;
185 template <
typename _Scalar>
187 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
189 typedef _Scalar Scalar;
196 typedef typename MathBase::MatrixXs MatrixXs;
198 template <
template <
typename Scalar>
class Model>
201 bool is_contact =
true;
204 if (d1 == NULL && d2 == NULL) {
206 "Invalid argument: the shared data should be derived from DataCollectorContact or DataCollectorImpulse");
213 const pinocchio::FrameIndex
id = model->get_id();
214 const boost::shared_ptr<StateMultibody>& state = boost::static_pointer_cast<StateMultibody>(model->get_state());
215 std::string frame_name = state->get_pinocchio()->frames[id].name;
216 bool found_contact =
false;
218 for (
typename ContactModelMultiple::ContactDataContainer::iterator it = d1->contacts->contacts.begin();
219 it != d1->contacts->contacts.end(); ++it) {
220 if (it->second->frame ==
id) {
223 found_contact =
true;
225 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
230 found_contact =
true;
234 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
239 for (
typename ImpulseModelMultiple::ImpulseDataContainer::iterator it = d2->impulses->impulses.begin();
240 it != d2->impulses->impulses.end(); ++it) {
241 if (it->second->frame ==
id) {
244 found_contact =
true;
246 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
251 found_contact =
true;
255 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
260 if (!found_contact) {
261 throw_pretty(
"Domain error: there isn't defined contact data for " + frame_name);
265 boost::shared_ptr<ForceDataAbstractTpl<Scalar> >
contact;
277 #include "crocoddyl/multibody/residuals/contact-wrench-cone.hxx"
Define a stack of impulse models.
Abstract class for residual models.
boost::shared_ptr< StateAbstract > state_
State description.
std::size_t nu_
Control dimension.
VectorXs unone_
No control vector.
State multibody representation.
MatrixXs Ru
Jacobian of the residual vector with respect the control.
MatrixXs Rx
Jacobian of the residual vector with respect the state.
DataCollectorAbstract * shared
Shared data allocated by the action model.
VectorXs r
Residual vector.