9 #ifndef CROCODDYL_MULTIBODY_RESIDUALS_CONTACT_WRENCH_CONE_HPP_
10 #define CROCODDYL_MULTIBODY_RESIDUALS_CONTACT_WRENCH_CONE_HPP_
12 #include "crocoddyl/core/residual-base.hpp"
13 #include "crocoddyl/core/utils/exception.hpp"
14 #include "crocoddyl/multibody/contact-base.hpp"
15 #include "crocoddyl/multibody/contacts/contact-3d.hpp"
16 #include "crocoddyl/multibody/contacts/contact-6d.hpp"
17 #include "crocoddyl/multibody/contacts/multiple-contacts.hpp"
18 #include "crocoddyl/multibody/data/contacts.hpp"
19 #include "crocoddyl/multibody/data/impulses.hpp"
20 #include "crocoddyl/multibody/fwd.hpp"
21 #include "crocoddyl/multibody/impulse-base.hpp"
22 #include "crocoddyl/multibody/impulses/impulse-3d.hpp"
23 #include "crocoddyl/multibody/impulses/impulse-6d.hpp"
24 #include "crocoddyl/multibody/impulses/multiple-impulses.hpp"
25 #include "crocoddyl/multibody/states/multibody.hpp"
26 #include "crocoddyl/multibody/wrench-cone.hpp"
54 template <
typename _Scalar>
58 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
60 typedef _Scalar Scalar;
68 typedef typename MathBase::VectorXs VectorXs;
69 typedef typename MathBase::MatrixXs MatrixXs;
70 typedef typename MathBase::MatrixX6s MatrixX6s;
86 const pinocchio::FrameIndex
id,
89 const bool fwddyn =
true);
102 const pinocchio::FrameIndex
id,
118 virtual void calc(
const boost::shared_ptr<ResidualDataAbstract>& data,
119 const Eigen::Ref<const VectorXs>& x,
120 const Eigen::Ref<const VectorXs>& u);
132 virtual void calc(
const boost::shared_ptr<ResidualDataAbstract>& data,
133 const Eigen::Ref<const VectorXs>& x);
147 virtual void calcDiff(
const boost::shared_ptr<ResidualDataAbstract>& data,
148 const Eigen::Ref<const VectorXs>& x,
149 const Eigen::Ref<const VectorXs>& u);
162 virtual void calcDiff(
const boost::shared_ptr<ResidualDataAbstract>& data,
163 const Eigen::Ref<const VectorXs>& x);
201 void set_id(
const pinocchio::FrameIndex
id);)
206 void set_reference(
const WrenchCone& reference);
213 virtual void print(std::ostream& os)
const;
222 bool update_jacobians_;
224 pinocchio::FrameIndex id_;
228 template <
typename _Scalar>
231 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
233 typedef _Scalar Scalar;
240 typedef typename MathBase::MatrixXs MatrixXs;
242 template <
template <
typename Scalar>
class Model>
245 :
Base(model, data) {
247 bool is_contact =
true;
252 if (d1 == NULL && d2 == NULL) {
254 "Invalid argument: the shared data should be derived from "
255 "DataCollectorContact or DataCollectorImpulse");
262 const pinocchio::FrameIndex
id = model->get_id();
263 const boost::shared_ptr<StateMultibody>& state =
264 boost::static_pointer_cast<StateMultibody>(model->get_state());
265 std::string frame_name = state->get_pinocchio()->frames[id].name;
266 bool found_contact =
false;
268 for (
typename ContactModelMultiple::ContactDataContainer::iterator it =
269 d1->contacts->contacts.begin();
270 it != d1->contacts->contacts.end(); ++it) {
271 if (it->second->frame ==
id) {
275 found_contact =
true;
278 "Domain error: there isn't defined at least a 6d contact for " +
285 found_contact =
true;
290 "Domain error: there isn't defined at least a 6d contact for " +
296 for (
typename ImpulseModelMultiple::ImpulseDataContainer::iterator it =
297 d2->impulses->impulses.begin();
298 it != d2->impulses->impulses.end(); ++it) {
299 if (it->second->frame ==
id) {
303 found_contact =
true;
306 "Domain error: there isn't defined at least a 6d contact for " +
313 found_contact =
true;
318 "Domain error: there isn't defined at least a 6d contact for " +
324 if (!found_contact) {
325 throw_pretty(
"Domain error: there isn't defined contact data for " +
330 boost::shared_ptr<ForceDataAbstractTpl<Scalar> >
343 #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.
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.