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

Allow specifying package locations manually #356

Open
wants to merge 1 commit into
base: ros2
Choose a base branch
from

Conversation

c-rizz
Copy link

@c-rizz c-rizz commented Feb 7, 2025

Following the work on using xacro without ROS I implemented a little change to allow using the find directive without ROS dependencies.
This allows to call xacro.process_doc() with a dict that associates package names to package paths. This is then used by the $(find ...) directive. If this argument is not specified all remains as before.
I find this to be quite useful when using multi-file xacro definitions when not using ROS.
I feel it would be a nice addition.

@traversaro
Copy link

A possible alternative would be permit users to specify somehow a function that resolves package references in place of the default implementation, in this way one could either provide an hardcoded mapping (as in this PR) or use some logic to find package paths based on environment variables (as done for example in https://github.com/ami-iit/resolve-robotics-uri-py .

@c-rizz
Copy link
Author

c-rizz commented Feb 8, 2025

I went with this solution as it is the most simple, and when using xacro from python a more complex resolution logic can always be implemented when forming the mapping dict. But yes, also a function could be passed in place of the dict.

@mjcarroll
Copy link
Member

mjcarroll commented Feb 13, 2025

Just a note that with the bazel implementation, I added a --root-dir flag that allows all includes to be resolved relative to that directory.

The way that this works for bazel is that the buildsystem copies (or symlinks) all of the dependencies of the build to a common temp directory, and then sets the --root-dir to that directory.

That was a quick way to get a similar behavior without getting the bazel semantics tied up in the xacro implementation. Could something similar be done here?

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