3#ifdef ALIGATOR_WITH_PINOCCHIO
8#ifdef ALIGATOR_PINOCCHIO_V3
17using Vector3or6 = Eigen::Matrix<double, -1, 1, Eigen::ColMajor, 6, 1>;
18using context::ConstVectorRef;
24using RigidConstraintModel =
25 pinocchio::RigidConstraintModelTpl<context::Scalar, 0>;
26using RigidConstraintData =
27 pinocchio::RigidConstraintDataTpl<context::Scalar, 0>;
29using RigidConstraintModelVector =
30 PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(RigidConstraintModel);
31using RigidConstraintDataVector =
32 PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(RigidConstraintData);
34const PolymorphicMultiBaseVisitor<StageFunction>
func_visitor;
36void exposeContactForce() {
37 using ContactForceResidual = ContactForceResidualTpl<Scalar>;
38 using ContactForceData = ContactForceDataTpl<Scalar>;
40 using MultibodyWrenchConeResidual = MultibodyWrenchConeResidualTpl<Scalar>;
41 using MultibodyWrenchConeData = MultibodyWrenchConeDataTpl<Scalar>;
43 using MultibodyFrictionConeResidual =
44 MultibodyFrictionConeResidualTpl<Scalar>;
45 using MultibodyFrictionConeData = MultibodyFrictionConeDataTpl<Scalar>;
47 bp::class_<ContactForceResidual, bp::bases<StageFunction>>(
48 "ContactForceResidual",
49 "A residual function :math:`r(x) = v_{j,xy} e^{-s z_j}` where :math:`j` "
50 "is a given frame index.",
52 .def(bp::init<
int, PinModel,
const context::MatrixXs &,
53 const RigidConstraintModelVector &,
54 const pinocchio::ProximalSettingsTpl<Scalar> &,
55 const Eigen::VectorXd &,
const std::string &>(bp::args(
56 "self",
"ndx",
"model",
"actuation_matrix",
"constraint_models",
57 "prox_settings",
"fref",
"contact_name")))
59 .def(
"getReference", &ContactForceResidual::getReference,
60 bp::args(
"self"), bp::return_internal_reference<>(),
61 "Get the target force.")
62 .def(
"setReference", &ContactForceResidual::setReference,
63 bp::args(
"self",
"fnew"),
"Set the target force.")
64 .def_readwrite(
"constraint_models",
65 &ContactForceResidual::constraint_models_);
67 bp::class_<ContactForceData, bp::bases<StageFunctionData>>(
"ContactForceData",
69 .def_readwrite(
"tau", &ContactForceData::tau_)
70 .def_readwrite(
"pin_data", &ContactForceData::pin_data_)
71 .def_readwrite(
"constraint_datas", &ContactForceData::constraint_datas_);
73 bp::class_<MultibodyWrenchConeResidual, bp::bases<StageFunction>>(
74 "MultibodyWrenchConeResidual",
"A residual function :math:`r(x) = Af` ",
76 .def(bp::init<
int, PinModel,
const context::MatrixXs &,
77 const RigidConstraintModelVector &,
78 const pinocchio::ProximalSettingsTpl<Scalar> &,
79 const std::string &,
const double,
const double,
80 const double>(bp::args(
81 "self",
"ndx",
"model",
"actuation_matrix",
"constraint_models",
82 "prox_settings",
"contact_name",
"mu",
"half_length",
"half_width")))
84 .def_readwrite(
"constraint_models",
85 &MultibodyWrenchConeResidual::constraint_models_);
87 bp::class_<MultibodyWrenchConeData, bp::bases<StageFunctionData>>(
88 "MultibodyWrenchConeData", bp::no_init)
89 .def_readwrite(
"tau", &MultibodyWrenchConeData::tau_)
90 .def_readwrite(
"pin_data", &MultibodyWrenchConeData::pin_data_)
91 .def_readwrite(
"constraint_datas",
92 &MultibodyWrenchConeData::constraint_datas_);
94 bp::class_<MultibodyFrictionConeResidual, bp::bases<StageFunction>>(
95 "MultibodyFrictionConeResidual",
"A residual function :math:`r(x) = Af` ",
97 .def(bp::init<
int, PinModel,
const context::MatrixXs &,
98 const RigidConstraintModelVector &,
99 const pinocchio::ProximalSettingsTpl<Scalar> &,
100 const std::string &,
const double>(
101 bp::args(
"self",
"ndx",
"model",
"actuation_matrix",
102 "constraint_models",
"prox_settings",
"contact_name",
"mu")))
104 .def_readwrite(
"constraint_models",
105 &MultibodyFrictionConeResidual::constraint_models_);
107 bp::class_<MultibodyFrictionConeData, bp::bases<StageFunctionData>>(
108 "MultibodyFrictionConeData", bp::no_init)
109 .def_readwrite(
"tau", &MultibodyFrictionConeData::tau_)
110 .def_readwrite(
"pin_data", &MultibodyFrictionConeData::pin_data_)
111 .def_readwrite(
"constraint_datas",
112 &MultibodyFrictionConeData::constraint_datas_);
pinocchio::ModelTpl< Scalar, Options > PinModel
StageFunctionTpl< Scalar > StageFunction
proxsuite::nlp::MultibodyPhaseSpace< Scalar > MultibodyPhaseSpace
StageFunctionDataTpl< Scalar > StageFunctionData
PolymorphicMultiBaseVisitor< StageFunction > func_visitor