robotics-toolbox-python: It is not possible to add new URDF robots in different path of models
I am giving my robotic class using this amazing tool in python library, but I found a problem. In an exercise, I want that student use a specific urdf, but It is not possible to view the mesh because Mesh.filename use an absolute path àbspath
to the models of the toolbox.
I know that this is the only error, because I change to the specific path and works, but I do not find which could be the best solution in the architecture of your code
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (11 by maintainers)
Ok, so default to current folder, then fallback to the distribution. We are thinking about putting the models in a separate package, they make the RTB package very large and don’t change much. This won’t affect operation from user perspective.
I’ve worked out a solution. No more need for
chdir
. My modified version: https://github.com/kxxt/swift/ I’ll open a pull request soon.Good news is I could load your mesh files after few tricks using the given minimal example.
Specifiying the absolute path https://github.com/petercorke/robotics-toolbox-python/blob/276efaaf3c67558cf2ef17e0360b6821fb8d7bfd/roboticstoolbox/tools/urdf/urdf.py#L307 using
value = os.path.abspath(value)
Move the “./xacro/lesson_urdf” folder to “./lesson_urdf”
This is a temporary workaround but shows a way to improve the toolbox later. e.g. if external file not exist->fallback to looking at predefined base_path from the toolbox.