Skip to content

Commit

Permalink
feat(template_ws): Auto compile in .bashrc
Browse files Browse the repository at this point in the history
Fixes: #40

Co-authored-by: assume <assume0701@gmail.com>
  • Loading branch information
j3soon and Assume-Zhan committed Aug 20, 2024
1 parent 79ac41c commit 2b509a7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion template_ws/docker/.bashrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Source global ROS2 environment
source /opt/ros/$ROS_DISTRO/setup.bash
# Check if the workspace has been built by check install/setup.bash
if [ ! -f $ROS2_WS/install/setup.bash ]; then
echo "Workspace has not been built yet. Building workspace..."
cd $ROS2_WS
# TODO: If command `arch` outputs `aarch64`, consider adding `--packages-ignore <package>` to ignore x86 packages
if [ $(arch) == "aarch64" ]; then
colcon build --symlink-install
else
colcon build --symlink-install
fi
echo "Workspace built."
fi
# Source workspace environment
# Note: If you have not built your workspace yet, the following command will fail
source $ROS2_WS/install/setup.bash

0 comments on commit 2b509a7

Please sign in to comment.