Skip to content

Commit 3da6485

Browse files
committed
Add proxy to friction binding
1 parent 7e00661 commit 3da6485

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

bindings/expose-friction-compensation.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,19 @@ namespace simple_mpc
1717
{
1818
namespace bp = boost::python;
1919

20-
/* Eigen::VectorXd computeFrictionProxy(
21-
FrictionCompensation & self,
22-
Eigen::Ref<const VectorXd> velocity,
23-
Eigen::Ref<VectorXd> torque) {
24-
self.computeFriction(velocity, torque);
20+
Eigen::VectorXd
21+
computeFrictionProxy(FrictionCompensation & self, Eigen::Ref<const VectorXd> velocity, Eigen::Ref<VectorXd> torque)
22+
{
23+
self.computeFriction(velocity, torque);
2524

26-
return torque;
27-
} */
25+
return torque;
26+
}
2827

2928
void exposeFrictionCompensation()
3029
{
3130
bp::class_<FrictionCompensation>(
3231
"FrictionCompensation", bp::init<const Model &, const bool>(bp::args("self", "model", "with_free_flyer")))
33-
.def("computeFriction", &FrictionCompensation::computeFriction)
32+
.def("computeFriction", &computeFrictionProxy)
3433
.add_property("dry_friction", &FrictionCompensation::dry_friction_)
3534
.add_property("viscuous_friction", &FrictionCompensation::viscuous_friction_);
3635
}

examples/go2_fulldynamics.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,13 @@
276276
)
277277

278278
qp_torque = qp.solved_torque.copy()
279-
fcompensation.computeFriction(x_interp[nq + 6:], qp_torque)
280-
device.execute(qp_torque)
279+
exit()
280+
friction_torque = fcompensation.computeFriction(x_interp[nq + 6:], qp_torque)
281+
device.execute(friction_torque)
281282

282-
u_multibody.append(copy.deepcopy(qp_torque))
283+
284+
285+
u_multibody.append(copy.deepcopy(friction_torque))
283286
x_multibody.append(x_measured)
284287

285288
force_FL = np.array(force_FL)

0 commit comments

Comments
 (0)