12 namespace newcontacts {
14 template <
typename Scalar>
16 boost::shared_ptr<StateMultibody> state,
const pinocchio::FrameIndex
id,
17 const Force& fref,
const std::size_t nc,
const std::size_t nu)
18 :
Base(state, id, fref, nc, nu) {}
20 template <
typename Scalar>
22 boost::shared_ptr<StateMultibody> state,
const pinocchio::FrameIndex
id,
23 const Force& fref,
const std::size_t nc)
24 :
Base(state, id, fref, nc) {}
26 template <
typename Scalar>
29 template <
typename Scalar>
31 const boost::shared_ptr<ResidualDataAbstract>& data,
32 const Eigen::Ref<const VectorXs>&,
const Eigen::Ref<const VectorXs>&) {
33 Data* d =
static_cast<Data*
>(data.get());
36 switch (d->contact_type) {
40 if (d1d->
type == pinocchio::LOCAL) {
41 data->r = d->contact->jMf.rotation().transpose().row(d1d->
mask) *
42 d->contact->f.linear() -
43 this->get_reference().linear().row(d1d->
mask);
44 }
else if (d1d->
type == pinocchio::WORLD ||
45 d1d->
type == pinocchio::LOCAL_WORLD_ALIGNED) {
47 (d1d->
oRf * d->contact->jMf.rotation().transpose()).row(d1d->
mask) *
48 d->contact->f.linear() -
49 this->get_reference().linear().row(d1d->
mask);
56 if (d3d->
type == pinocchio::LOCAL) {
57 data->r = (d->contact->jMf.actInv(d->contact->f).linear() -
58 this->get_reference().linear());
59 }
else if (d3d->
type == pinocchio::WORLD ||
60 d3d->
type == pinocchio::LOCAL_WORLD_ALIGNED) {
61 data->r = (d3d->
oRf * d->contact->jMf.actInv(d->contact->f).linear() -
62 this->get_reference().linear());
69 if (d6d->
type == pinocchio::LOCAL) {
71 (d->contact->jMf.actInv(d->contact->f) - this->get_reference())
73 }
else if (d6d->
type == pinocchio::WORLD ||
74 d6d->
type == pinocchio::LOCAL_WORLD_ALIGNED) {
75 data->r = (d6d->
lwaMl.act(d->contact->jMf.actInv(d->contact->f)) -
76 this->get_reference())
86 template <
typename Scalar>
88 const boost::shared_ptr<ResidualDataAbstract>& data,
89 const Eigen::Ref<const VectorXs>&,
const Eigen::Ref<const VectorXs>&) {
90 Data* d =
static_cast<Data*
>(data.get());
92 const MatrixXs& df_dx = d->contact->df_dx;
93 const MatrixXs& df_du = d->contact->df_du;
95 switch (d->contact_type) {
97 data->Rx = df_dx.template topRows<1>();
98 data->Ru = df_du.template topRows<1>();
102 data->Rx = df_dx.template topRows<3>();
103 data->Ru = df_du.template topRows<3>();