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

Add python bindings for FloatingBaseEstimator and LeggedOdometry #218

Merged

Conversation

prashanthr05
Copy link
Collaborator

@prashanthr05 prashanthr05 commented Mar 1, 2021

Testing is pending.

  • Add a test script

Copy link
Member

@diegoferigo diegoferigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @prashanthr05, looks good to me apart minor nits. A simple example / test would be highly appreciated, especially to provide users a basic way to configure these newly exposed classes.

Comment on lines +139 to +141
// at the moment at an interface level, this nested class need not be exposed
// but in case, we want to use the FloatingBaseEstimator as base class
// for python based implementations, maybe it could be useful
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely possible with pybind, but it requires quite a lot of work since it demands creating a dummy class (called trampoline) for the interface. In my opinion, once the entire infrastructure is up and running, this could be a great alternative for prototyping, but as you wrote, let's keep this option for future work.


py::class_<FloatingBaseEstimator, Advanceable<Output>> floatingBaseEstimator(module, "FloatingBaseEstimator");

floatingBaseEstimator.def(py::init())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to separate methods definition from the creation of the py::class_ object?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, only now I see that the object is used below, good to know!

.def("get", &FloatingBaseEstimator::get)
.def("is_valid", &FloatingBaseEstimator::isValid)
.def("initialize",
[](FloatingBaseEstimator& impl, std::shared_ptr<IParametersHandler> handler, std::shared_ptr<iDynTree::KinDynComputations> kinDyn) -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these files are not formatted with project's clang-format. This line for instance seems way too long.

@GiulioRomualdi I see this in many files of blf. Do you think that a new specific PR that uniforms all the files of this project (and then enforcing it) could be done? In order to minimize conflicts, maybe we can do it in a moment with no open PRs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @GiulioRomualdi for taking care of the formatting in 0a86455

@prashanthr05
Copy link
Collaborator Author

A simple example / test would be highly appreciated, especially to provide users a basic way to configure these newly exposed classes.

Yes, I am going to prepare a test script for that.

@prashanthr05
Copy link
Collaborator Author

A simple example / test would be highly appreciated, especially to provide users a basic way to configure these newly exposed classes.

Yes, I am going to prepare a test script for that.

I have added an interface test describing how to run the estimator in this commit c515ba4

Copy link
Member

@diegoferigo diegoferigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized I was commenting in the commit, moved random comments in this review.

bindings/python/tests/test_legged_odometry.py Outdated Show resolved Hide resolved
bindings/python/tests/test_legged_odometry.py Outdated Show resolved Hide resolved
bindings/python/tests/test_legged_odometry.py Outdated Show resolved Hide resolved
bindings/python/tests/test_legged_odometry.py Outdated Show resolved Hide resolved
@GiulioRomualdi
Copy link
Member

Thank you all for the effort 😄

@GiulioRomualdi GiulioRomualdi merged commit 06fecff into ami-iit:master Mar 2, 2021
@prashanthr05 prashanthr05 deleted the pybind/floatingBaseEstimators branch March 2, 2021 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants