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);
115 virtual void calcDiff(
const boost::shared_ptr<ResidualDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
116 const Eigen::Ref<const VectorXs>& u);
139 void set_id(
const pinocchio::FrameIndex
id);
151 virtual void print(std::ostream& os)
const;
159 pinocchio::FrameIndex id_;
163 template <
typename _Scalar>
165 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
167 typedef _Scalar Scalar;
174 typedef typename MathBase::MatrixXs MatrixXs;
176 template <
template <
typename Scalar>
class Model>
179 bool is_contact =
true;
182 if (d1 == NULL && d2 == NULL) {
184 "Invalid argument: the shared data should be derived from DataCollectorContact or DataCollectorImpulse");
191 const pinocchio::FrameIndex
id = model->get_id();
192 const boost::shared_ptr<StateMultibody>& state = boost::static_pointer_cast<StateMultibody>(model->get_state());
193 std::string frame_name = state->get_pinocchio()->frames[id].name;
194 bool found_contact =
false;
196 for (
typename ContactModelMultiple::ContactDataContainer::iterator it = d1->contacts->contacts.begin();
197 it != d1->contacts->contacts.end(); ++it) {
198 if (it->second->frame ==
id) {
201 found_contact =
true;
203 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
208 found_contact =
true;
212 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
217 for (
typename ImpulseModelMultiple::ImpulseDataContainer::iterator it = d2->impulses->impulses.begin();
218 it != d2->impulses->impulses.end(); ++it) {
219 if (it->second->frame ==
id) {
222 found_contact =
true;
224 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
229 found_contact =
true;
233 throw_pretty(
"Domain error: there isn't defined at least a 6d contact for " + frame_name);
238 if (!found_contact) {
239 throw_pretty(
"Domain error: there isn't defined contact data for " + frame_name);
243 boost::shared_ptr<ForceDataAbstractTpl<Scalar> >
contact;
255 #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.