9 #include <crocoddyl/core/utils/exception.hpp>
10 #include <pinocchio/algorithm/frames-derivatives.hpp>
11 #include <pinocchio/algorithm/frames.hpp>
12 #include <pinocchio/algorithm/kinematics-derivatives.hpp>
18 using namespace crocoddyl;
20 template <
typename Scalar>
22 boost::shared_ptr<StateMultibody> state,
23 const pinocchio::FrameIndex contact_id,
const std::size_t nu)
24 :
Base(state, 2, nu, true, true, true), contact_id_(contact_id) {}
26 template <
typename Scalar>
29 template <
typename Scalar>
31 const boost::shared_ptr<ResidualDataAbstract> &data,
32 const Eigen::Ref<const VectorXs> & ,
33 const Eigen::Ref<const VectorXs> &) {
34 Data *d =
static_cast<Data *
>(data.get());
37 if (f.linear()[2] != 0.0) {
38 data->r[0] = f.angular()[1] / f.linear()[2];
39 data->r[1] = -f.angular()[0] / f.linear()[2];
46 template <
typename Scalar>
48 const boost::shared_ptr<ResidualDataAbstract> &data,
49 const Eigen::Ref<const VectorXs> &,
const Eigen::Ref<const VectorXs> &) {
50 Data *d =
static_cast<Data *
>(data.get());
57 if (f.linear()[2] != 0.0) {
58 data->Rx.row(0) = df_dx.row(4);
59 data->Rx.row(1) = -df_dx.row(3);
60 data->Rx.row(0) -= data->r[0] * df_dx.row(2);
61 data->Rx.row(1) -= data->r[1] * df_dx.row(2);
62 data->Rx /= f.linear()[2];
64 data->Ru.row(0) = df_du.row(4);
65 data->Ru.row(1) = -df_du.row(3);
66 data->Ru.row(0) -= data->r[0] * df_du.row(2);
67 data->Ru.row(1) -= data->r[1] * df_du.row(2);
68 data->Ru /= f.linear()[2];
75 template <
typename Scalar>
76 boost::shared_ptr<ResidualDataAbstractTpl<Scalar> >
79 return boost::allocate_shared<Data>(Eigen::aligned_allocator<Data>(),
this,