Skip to content

Commit

Permalink
fix(orbslam3_ws): Fix docker error
Browse files Browse the repository at this point in the history
  • Loading branch information
j3soon committed Aug 22, 2024
1 parent f572b54 commit e4b3da4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
31 changes: 31 additions & 0 deletions orbslam3_ws/docker/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Source global ROS2 environment
source /opt/ros/$ROS_DISTRO/setup.bash
# Optionally perform apt update if it has not been executed yet
if [ -z "$( ls -A '/var/lib/apt/lists' )" ]; then
echo "apt-get update has not been executed yet. Running sudo apt-get update..."
sudo apt-get update
fi
# Optionally perform rosdep update if it has not been executed yet
if [ ! -d $HOME/.ros/rosdep/sources.cache ]; then
echo "rosdep update has not been executed yet. Running rosdep update..."
rosdep update
fi
# Optionally build the workspace if it has not been built yet
if [ ! -f $ROS2_WS/install/setup.bash ]; then
echo "Workspace has not been built yet. Building workspace..."
cd $ROS2_WS
# Ref: https://docs.ros.org/en/humble/Tutorials/Intermediate/Rosdep.html
rosdep install --from-paths src --ignore-src -y -r
# TODO: If command `arch` outputs `aarch64`, consider adding `--packages-ignore <package>` to ignore x86 packages
# Ref: https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html
if [ $(arch) == "aarch64" ]; then
colcon build --symlink-install
else
colcon build --symlink-install
fi
echo "Workspace built."
fi
# TODO: Source other workspace environments as underlay
source ~/test_ws/install/local_setup.bash
# Source workspace environment
source $ROS2_WS/install/setup.bash
1 change: 1 addition & 0 deletions orbslam3_ws/docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*
!.bashrc
2 changes: 1 addition & 1 deletion tests/lint_comp_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ def error(msg, i):
compare_file_with_template(".devcontainer/devcontainer.json", ignored_workspaces=["ros1_bridge_ws"])
compare_file_with_template(".gitignore")
compare_file_with_template("docker/.bashrc")
compare_file_with_template("docker/.dockerignore", ignored_workspaces=["ros1_bridge_ws", "orbslam3_ws"])
compare_file_with_template("docker/.dockerignore", ignored_workspaces=["ros1_bridge_ws"])
compare_file_with_template("docker/compose.yaml", ignored_workspaces=["ros1_bridge_ws"])
compare_file_with_template("docker/Dockerfile", ignored_workspaces=["ros1_bridge_ws"])
3 changes: 1 addition & 2 deletions tests/lint_filenames.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
for workspace_path in glob.glob(f"{repo_dir}/*_ws"):
if not os.path.isfile(f"{workspace_path}/{filename}"):
# Skip certain cases intentionally
if filename in (".gitignore", "docker/.bashrc") and os.path.basename(workspace_path) == "ros1_bridge_ws" or \
filename in ("docker/.bashrc") and os.path.basename(workspace_path) == "orbslam3_ws":
if filename in (".gitignore", "docker/.bashrc") and os.path.basename(workspace_path) == "ros1_bridge_ws":
continue
# Report error
raise ValueError(f"'{filename}' does not exist in: '{workspace_path}'")
Expand Down

0 comments on commit e4b3da4

Please sign in to comment.