From a3583a076e8a8a79b90d9709080ce5d2bbec8d20 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Thu, 12 Oct 2023 14:25:36 +0900 Subject: [PATCH] [install-dependencies] Better handle ROS2 --- install-dependencies/index.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/install-dependencies/index.js b/install-dependencies/index.js index 1f0d857..c95881e 100644 --- a/install-dependencies/index.js +++ b/install-dependencies/index.js @@ -297,7 +297,7 @@ async function use_ros_workspace(setup) for(let V of vars.split('\n')) { let [name, value] = V.split('='); - if(name && name.startsWith('ROS')) + if(name && (name.startsWith('ROS') || name.startsWith('AMENT'))) { core.exportVariable(name, value); } @@ -334,12 +334,22 @@ async function handle_ros(ros) core.endGroup(); } core.startGroup('Install ROS base packages'); - await exec.exec(`sudo apt-get install -y ros-${ros_distro}-ros-base python3-catkin-tools python3-rosdep python3-wstool`); - core.endGroup(); - core.startGroup('Initialize rosdep'); - await exec.exec('sudo rosdep init'); - await exec.exec('rosdep update --include-eol-distros'); + if(!is_ros2) + { + await exec.exec(`sudo apt-get install -y ros-${ros_distro}-ros-base python3-catkin-tools python3-rosdep python3-wstool`); + } + else + { + await exec.exec(`sudo apt-get install -y ros-${ros_distro}-ros-base python3-colcon-common-extensions`); + } core.endGroup(); + if(!is_ros2) + { + core.startGroup('Initialize rosdep'); + await exec.exec('sudo rosdep init'); + await exec.exec('rosdep update --include-eol-distros'); + core.endGroup(); + } core.startGroup('Setup ROS env'); await use_ros_workspace(`/opt/ros/${ros_distro}/setup.bash`); core.endGroup();