Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python bidings for the measured force contact #251

Open
wants to merge 8 commits into
base: devel
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adding addMeasuredForce to the formulation bindings
Alexandre committed Mar 10, 2025
commit 3f73b34876a13190a51a0a7bc8392c84d24d3f6a
8 changes: 7 additions & 1 deletion include/tsid/bindings/python/formulations/formulation.hpp
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
#include "tsid/contacts/contact-6d.hpp"
#include "tsid/contacts/contact-point.hpp"
#include "tsid/contacts/contact-two-frame-positions.hpp"
#include "tsid/contacts/measured-6Dwrench.hpp"
#include "tsid/tasks/task-joint-posture.hpp"
#include "tsid/tasks/task-se3-equality.hpp"
#include "tsid/tasks/task-com-equality.hpp"
@@ -127,7 +128,9 @@ struct InvDynPythonVisitor
.def("checkContact", &InvDynPythonVisitor::checkContact,
bp::args("name", "HQPOutput"))
.def("getContactForce", &InvDynPythonVisitor::getContactForce,
bp::args("name", "HQPOutput"));
bp::args("name", "HQPOutput"))
.def("addMeasuredForce", &InvDynPythonVisitor::addMeasuredForce,
bp::args("measured_force"));
}
static pinocchio::Data data(T& self) {
pinocchio::Data data = self.data();
@@ -273,6 +276,9 @@ struct InvDynPythonVisitor
const solvers::HQPOutput& sol) {
return self.getContactForces(name, sol);
}
static bool addMeasuredForce(T& self, contacts::Measured6Dwrench measured_force) {
return self.addMeasuredForce(measured_force);
}

static void expose(const std::string& class_name) {
std::string doc = "InvDyn info.";
4 changes: 2 additions & 2 deletions tests/python/test_Measured6DWrench.py
Original file line number Diff line number Diff line change
@@ -22,10 +22,10 @@
frameName = "RAnkleRoll"
contact = tsid.Measured6Dwrench(
"Measured6Dwrench", robot, frameName)
wrench = np.asarray([1.5, 1.5, 1.5, 2.5, 2.5, 2.5])
wrench = np.asarray([1.5, 1.5, 1.5, 2.5, 2.5, 2.5]) # Some random wrench
contact.setMeasuredContactForce(wrench)
measured_wrench = contact.measuredContactForce
print(measured_wrench)

invdyn = tsid.InverseDynamicsFormulationAccForce("tsid", robot, False)
invdyn.addMeasuredForce(contact)
invdyn.addMeasuredForce(contact)