Sourcing setup in ROS2 slow

asked 2018-09-06 10:09:37 -0600

uthinu gravatar image

updated 2018-09-06 10:10:15 -0600

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?

edit retag flag offensive close merge delete


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).

allenh1 gravatar image allenh1  ( 2018-09-06 15:12:42 -0600 )edit

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?)

uthinu gravatar image uthinu  ( 2018-09-06 16:08:45 -0600 )edit

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.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-09-06 16:47:42 -0600 )edit

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.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-09-06 16:48:41 -0600 )edit

More than 1800 scripts are run in total by local-setup. I will try sourcing in /etc/rc.local instead.

uthinu gravatar image uthinu  ( 2018-09-07 05:35:13 -0600 )edit