Coder Social home page Coder Social logo

ami-iit / resolve-robotics-uri-py Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 29 KB

Resolve a package:// or model:// URI to an absolute filename in Python.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
gazebo robotics ros ros2 sdf urdf urdf-descriptions urdf-models sdformat

resolve-robotics-uri-py's Introduction

resolve-robotics-uri-py

Pure Python package (that only depends on Python stdlib) to resolve a package:// (ROS-style) or model:// (Gazebo-style) URI to an absolute filename.

Installation

Install using onle one of the following commands to install in an existing environment:

Installation from conda-forge

mamba install -c conda-forge resolve-robotics-uri-py

Installation from PyPI

python -m pip install resolve-robotics-uri-py

Usage in Python

Add import resolve_robotics_uri_py to your Python file, then take inspiration from the following examples.

If you want to get the location of the iCubGazeboV2_7 iCub model installed from icub-models:

absolute_path = resolve_robotics_uri_py.resolve_robotics_uri("package://iCub/robots/iCubGazeboV2_7/model.urdf")

If you want to get the location of the ergoCubSN00 model installed from ergocub-software:

absolute_path = resolve_robotics_uri_py.resolve_robotics_uri("package://ergoCub/robots/ergoCubSN000/model.urdf")

If you want to get the location of the panda model installed by moveit_resources_panda_description:

absolute_path = resolve_robotics_uri_py.resolve_robotics_uri("package://moveit_resources_panda_description/urdf/panda.urdf")

Command Line usage

resolve_robotics_uri_py also install a command line tool called resolve-robotics-uri-py for use in scripts, that can be used as:

resolve-robotics-uri-py package://iCub/robots/iCubGazeboV2_7/model.urdf

For example, on bash this can be used to easily convert the a urdf specified via package:// to an sdf (assuming you have Gazebo installed), using the backtick operator:

gz sdf -p `resolve-robotics-uri-py package://iCub/robots/iCubGazeboV2_7/model.urdf`

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

BSD-3-Clause

resolve-robotics-uri-py's People

Contributors

diegoferigo avatar flferretti avatar traversaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

resolve-robotics-uri-py's Issues

Allow user to pass custom search paths

When using robot_descriptions, this library cannot resolve the URIs due to the fact that robot_descriptions does not expose any environment variable of the one supported:

SupportedEnvVars = {
    "AMENT_PREFIX_PATH",
    "GAZEBO_MODEL_PATH",
    "GZ_SIM_RESOURCE_PATH",
    "IGN_GAZEBO_RESOURCE_PATH",
    "ROS_PACKAGE_PATH",
    "SDF_PATH",
}

As a result, resolve_robotics_uri_py cannot locate the necessary resources. Do you think that it could be beneficial to allow passing an additional environment variable for specifying custom search path as in 1c9e78f?

C.C. @traversaro @lorycontixd

Simplify import structure for `resolve_robotics_uri` function

The current package organization needs the following import statement for using the resolve_robotics_uri function:

from resolve_robotics_uri_py.resolve_robotics_uri_py import resolve_robotics_uri

In the interest of maintaining concise import statements, the idea is to include the following line within the __init__.py file, simplifying the package import process:

from .resolve_robotics_uri_py import resolve_robotics_uri

This adjustment would allow to import the function using the following compact syntax:

from resolve_robotics_uri_py import resolve_robotics_uri

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.