Skip to content

Feature/python bindings/navigation#3310

Merged
randaz81 merged 4 commits intorobotology:yarp-3.12from
elandini84:feature/python_bindings/navigation
Jan 15, 2026
Merged

Feature/python bindings/navigation#3310
randaz81 merged 4 commits intorobotology:yarp-3.12from
elandini84:feature/python_bindings/navigation

Conversation

@elandini84
Copy link
Copy Markdown
Contributor

Bindings

dev

INavigation2D, ILocalization2D, IMap2D

  • Added bindings for yarp::dev::INavigation2D, yarp::dev::IMap2D, yarp::dev::ILocalization2D interfaces

@elandini84 elandini84 requested a review from randaz81 as a code owner January 8, 2026 13:16
@elandini84 elandini84 added PR Type: Feat/Enh This PR adds some new feature or enhances some part of YARP Component: Bindings swig, python, java, ruby, perl, octave, matlab, lua, csharp, tcl Target: YARP yarp-3.12 labels Jan 8, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @elandini84, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances YARP's Python interoperability by introducing bindings for its 2D navigation, mapping, and localization interfaces. This allows Python developers to seamlessly integrate and control YARP-based robotic navigation systems, facilitating tasks such as querying robot pose, managing environmental maps, and orchestrating navigation goals directly from Python applications. The changes expand the utility of YARP within the Python ecosystem for robotics development.

Highlights

  • Python Bindings for Navigation Interfaces: Added comprehensive Python bindings for the yarp::dev::INavigation2D, yarp::dev::IMap2D, and yarp::dev::ILocalization2D interfaces, enabling Python applications to interact with YARP's 2D navigation functionalities.
  • Support for Navigation Data Types: Included necessary header files and instantiated templates for various Map2D related data types (e.g., Map2DLocationData, MapGrid2D, NavTypes) to ensure full support for navigation data structures within the Python bindings.
  • PolyDriver View Methods: Implemented view methods within yarp::dev::PolyDriver to allow casting to the new INavigation2D, ILocalization2D, and IMap2D interfaces, simplifying access to these interfaces from a PolyDriver instance.
  • Python-Friendly Wrapper Methods: Extended the ILocalization2D, IMap2D, and INavigation2D interfaces with convenience wrapper methods, making their functionalities more accessible and idiomatic for Python users (e.g., getLocalizationStatus, get_map_names, getAbsoluteLocationOfCurrentTarget).
  • Documentation Update: Added a new release documentation file (feature_python_bindings_navigation.md) to detail the introduction of these new Python bindings for navigation interfaces.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds Python bindings for the YARP navigation interfaces INavigation2D, ILocalization2D, and IMap2D. The changes involve updating the SWIG interface file (yarp.i) to include the necessary headers, type definitions, and wrapper functions. Release notes and a central header file are also updated.

The implementation is mostly correct and follows existing patterns. I have a couple of suggestions to improve maintainability:

  • In bindings/yarp.i, the new %include directives could be sorted alphabetically within their logical groups to improve readability.
  • Also in bindings/yarp.i, the new view methods for namespaced interfaces are manually implemented. Creating a new macro for this would reduce code duplication and make future extensions easier.

Overall, this is a good addition that expands YARP's Python bindings to important navigation functionalities.

Comment thread bindings/yarp.i
Comment on lines +461 to +473
%include <yarp/dev/ILocalization2D.h>
%include <yarp/dev/IMap2D.h>
%include <yarp/dev/INavigation2D.h>
%include <yarp/dev/Map2DLocationData.h>
%include <yarp/dev/Map2DObjectData.h>
%include <yarp/dev/Map2DPathData.h>
%include <yarp/dev/Map2DAreaData.h>
%include <yarp/dev/Map2DLocation.h>
%include <yarp/dev/Map2DObject.h>
%include <yarp/dev/Map2DPath.h>
%include <yarp/dev/Map2DArea.h>
%include <yarp/dev/MapGrid2D.h>
%include <yarp/dev/NavTypes.h>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The new %include directives for navigation interfaces and types are not sorted alphabetically within their logical groups. Sorting them would improve readability and maintainability of this file.

%include <yarp/dev/ILocalization2D.h>
%include <yarp/dev/IMap2D.h>
%include <yarp/dev/INavigation2D.h>
%include <yarp/dev/Map2DAreaData.h>
%include <yarp/dev/Map2DLocationData.h>
%include <yarp/dev/Map2DObjectData.h>
%include <yarp/dev/Map2DPathData.h>
%include <yarp/dev/Map2DArea.h>
%include <yarp/dev/Map2DLocation.h>
%include <yarp/dev/Map2DObject.h>
%include <yarp/dev/Map2DPath.h>
%include <yarp/dev/MapGrid2D.h>
%include <yarp/dev/NavTypes.h>

Comment thread bindings/yarp.i
Comment on lines +769 to +785
yarp::dev::Nav2D::INavigation2D *viewINavigation2D() {
yarp::dev::Nav2D::INavigation2D *result;
self->view(result);
return result;
}

yarp::dev::Nav2D::ILocalization2D *viewILocalization2D() {
yarp::dev::Nav2D::ILocalization2D *result;
self->view(result);
return result;
}

yarp::dev::Nav2D::IMap2D *viewIMap2D() {
yarp::dev::Nav2D::IMap2D *result;
self->view(result);
return result;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

These view methods for Nav2D interfaces are manually implemented, leading to code duplication. This is similar to what the CAST_POLYDRIVER_TO_INTERFACE macro does for interfaces in the yarp::dev namespace.

To improve maintainability and reduce code duplication, you could define a new macro that handles interfaces within a specific namespace. The comment on line 732 suggests this was considered, but no macro was implemented.

For example, you could define a macro like this somewhere appropriate:

%define CAST_POLYDRIVER_TO_INTERFACE_IN_NAMESPACE(ns, interface)
    ns::interface *view ## interface() {
        ns::interface *result;
        self->view(result);
        return result;
    }
%enddef

And then replace the manual implementations with macro calls. This would make the code cleaner and easier to extend with more namespaced interfaces in the future.

    yarp::dev::Nav2D::INavigation2D *viewINavigation2D();

    yarp::dev::Nav2D::ILocalization2D *viewILocalization2D();

    yarp::dev::Nav2D::IMap2D *viewIMap2D();

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 9, 2026

@randaz81 randaz81 merged commit eb656f9 into robotology:yarp-3.12 Jan 15, 2026
63 of 71 checks passed
@randaz81 randaz81 added this to the YARP 3.12.3 milestone Jan 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Bindings swig, python, java, ruby, perl, octave, matlab, lua, csharp, tcl PR Type: Feat/Enh This PR adds some new feature or enhances some part of YARP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants