Skip to content

Commit 2b509a7

Browse files
j3soonAssume-Zhan
andcommitted
feat(template_ws): Auto compile in .bashrc
Fixes: #40 Co-authored-by: assume <assume0701@gmail.com>
1 parent 79ac41c commit 2b509a7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

template_ws/docker/.bashrc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Source global ROS2 environment
22
source /opt/ros/$ROS_DISTRO/setup.bash
3+
# Check if the workspace has been built by check install/setup.bash
4+
if [ ! -f $ROS2_WS/install/setup.bash ]; then
5+
echo "Workspace has not been built yet. Building workspace..."
6+
cd $ROS2_WS
7+
# TODO: If command `arch` outputs `aarch64`, consider adding `--packages-ignore <package>` to ignore x86 packages
8+
if [ $(arch) == "aarch64" ]; then
9+
colcon build --symlink-install
10+
else
11+
colcon build --symlink-install
12+
fi
13+
echo "Workspace built."
14+
fi
315
# Source workspace environment
4-
# Note: If you have not built your workspace yet, the following command will fail
516
source $ROS2_WS/install/setup.bash

0 commit comments

Comments
 (0)