Sourcing setup in ROS2 slow
Hi, I had no problems with the time of sourcing setups in ardent, it was almost instantaneous so I have put the sourcing into /etc/bash.bashrc
. But with ROS2, it has become very slow, there is a resulting long pause before any bash session:
$ time source /home/art/ros2_ws/install/setup.bash
real 0m6.734s
user 0m5.344s
sys 0m0.340s
Can the execution time be improved?
Did you try sourcing
~art/ros2_ws/install/local_setup.bash
? In general, I would avoid adding that line to/etc/bash.bashrc
and instead add it to~art/.bashrc
(so you don't make other users suffer).Times are comparable for these two scripts. I did a simple check and I guess that something slow called
package.bash
is called many times (for each package?)You can set the env vars
AMENT_TRACE_SETUP_FILES=1
/COLCON_TRACE=1
to see which files are being sourced. There is certainly some overlap in them at the moment.Could it be that your Ardent ws was using a merged install while your Bouncy ws is using an isolated install? The isolated install certainly takes longer to setup due to its numerous separate paths.
More than 1800 scripts are run in total by local-setup. I will try sourcing in /etc/rc.local instead.
https://github.com/ros2/ros2/issues/573