space-ros / simulation

Simulation assets of space-ros demos
8 stars 19 forks source link

Model paths not being generated correctly by xacro file #6

Closed mkhansenbot closed 9 months ago

mkhansenbot commented 11 months ago

The model paths in models/curiosity_path/urdf/curiosity_mars_rover.xacro are wrong, they are missing the /models prefix.

See issue #5 for more details

To reproduce:

# from the space-ros workspace folder
colcon build --packages-up-to simulation
source install/setup.bash
xacro -o curiosity_mars_rover.xacro.urdf curiosity_mars_rover.xacro

This will generate the urdf file but when loaded at runtime, errors will occur that it can't find the paths for the files.

root@ip-172-31-62-201:/home/spaceros-user/demos_ws# ros2 launch mars_rover mars_rover.launch.py
[INFO] [launch]: All log files can be found below /root/.ros/log/2023-09-27-15-14-56-231717-ip-172-31-62-201-347334
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [py]: No such file or directory: /home/spaceros-user/demos_ws/install/simulation/share/simulation/curiosity_path/urdf/macros.xacro [Errno 2] No such file or directory: '/home/spaceros-user/demos_ws/install/simulation/share/simulation/curiosity_path/urdf/macros.xacro'
root@ip-172-31-62-201:/home/spaceros-user/demos_ws# 

The solution to this is to:

  1. add the /models path correctly to the curiosity_mars_rover.xacro file
  2. use that file directly in the mars_rover.launch.py file
  3. remove the curiosity_mars_rover.xacro.urdf file and use xacro at runtime directly