From 00faa95df4dc59d13d58c94e935a8945b38ccf95 Mon Sep 17 00:00:00 2001 From: Fu Zhengyu Date: Fri, 28 Jun 2024 16:20:43 +0000 Subject: [PATCH 1/7] add feature lock file --- .devcontainer/devcontainer-lock.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .devcontainer/devcontainer-lock.json diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 0000000..c42de36 --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -0,0 +1,19 @@ +{ + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "version": "2.4.3", + "resolved": "ghcr.io/devcontainers/features/common-utils@sha256:e9e1d402031416ed5fc500f242c27ffa1043a27b5ba612e6596ea62503c8ae70", + "integrity": "sha256:e9e1d402031416ed5fc500f242c27ffa1043a27b5ba612e6596ea62503c8ae70" + }, + "ghcr.io/devcontainers/features/desktop-lite:1": { + "version": "1.2.0", + "resolved": "ghcr.io/devcontainers/features/desktop-lite@sha256:3ae291711d296da3829948600f49c9acf26f58c14ff636f34240fbf240deaf43", + "integrity": "sha256:3ae291711d296da3829948600f49c9acf26f58c14ff636f34240fbf240deaf43" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "1.3.0", + "resolved": "ghcr.io/devcontainers/features/git@sha256:aa0f267b6f10c7a1ba2545d6beb5d3d8576b584d5017dce4ba2d61d409f342f9", + "integrity": "sha256:aa0f267b6f10c7a1ba2545d6beb5d3d8576b584d5017dce4ba2d61d409f342f9" + } + } +} \ No newline at end of file From 692b29a5813ddbd7857cce8502dda088b97bdbbb Mon Sep 17 00:00:00 2001 From: Fu Zhengyu Date: Fri, 28 Jun 2024 16:21:12 +0000 Subject: [PATCH 2/7] do not pull image if exists locally --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7cee737..4a7e803 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -49,7 +49,7 @@ "onAutoForward": "ignore" }, "containerUser": "robotx", - "initializeCommand": "docker pull ghcr.io/ethz-robotx/rss_workspace:main", + // "initializeCommand": "docker pull ghcr.io/ethz-robotx/rss_workspace:main", "postCreateCommand": "bash ./.devcontainer/post-create.sh", "customizations": { "vscode": { From e29220e7d700916c8e78b44c8b8f9576c26ffc56 Mon Sep 17 00:00:00 2001 From: Fu Zhengyu Date: Fri, 28 Jun 2024 16:24:42 +0000 Subject: [PATCH 3/7] add vcs completions;do not vcs pull if src exists --- .devcontainer/post-create.sh | 81 ++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index e302e2a..a2cacea 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -10,48 +10,55 @@ echo "export HISTFILE=${ROOT}/.zsh_history" >> ~/.zshrc echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc echo "source /opt/ros/noetic/setup.zsh" >> ~/.zshrc -# Setup fzf +# Setup fzf completions echo "eval \"\$(fzf --bash)\"" >> ~/.bashrc echo "source <(fzf --zsh)" >> ~/.zshrc +# Setup vcs completions +echo "source /usr/share/vcstool-completion/vcs.bash" >> ~/.bashrc +echo "source /usr/share/vcstool-completion/vcs.zsh" >> ~/.zshrc + # Setup aliases source "${ROOT}/.devcontainer/setup_alias.sh" ${ROOT} -# Make folder `src` if not exists +# Clone repositories and configure the workspace if `src` folder does not exist if [ ! -d "${ROOT}/src" ]; then + # Create the `src` folder mkdir -p "${ROOT}/src" -fi - -# Clone the repository -vcs import --input "${SMB_RAW_REPO_FILE_URL}" --recursive --skip-existing "${ROOT}/src" - -# Setup catkin workspace -catkin init --workspace "${ROOT}" &>/dev/null - -# Generate buildlist for catkin config -# NOTE: catkin build will only build the packages themselve listed in the buildlist but not their dependencies -# so we need to generate a buildlist of packages that are recursively dependent on the packages we want to build -# NOTE: The input to the script is a list of top-level packages to build and the output is the complete list of packages to build -# NOTE: You can use the `scripts/list_top_level_packages.sh` script to list the top level packages in the workspace -# CAUTION: This script should be run after the workspace is created and the repositories are cloned as it uses the workspace to generate the buildlist -BUILD_PKG_LIST=$(python3 "${ROOT}/.devcontainer/generate_catkin_buildlist.py" --workspace "${ROOT}" \ - catkin_simple \ - smb_exploration \ - smb_gazebo \ - smb_mission_planner \ - smb_mpc \ - smb_msf \ - smb_msf_graph \ - smb_path_planner \ - object_detection \ - ) - -# Split the string into an array of package names to pass to catkin config as positional arguments -IFS=' ' read -r -a BUILD_PKGS_ARRAY <<< "${BUILD_PKG_LIST}" - -# Configure the workspace -catkin config --workspace "${ROOT}" \ - --extend /opt/ros/noetic \ - --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -- \ - --buildlist "${BUILD_PKGS_ARRAY[@]}" - \ No newline at end of file + + # Clone the repository + vcs import --input "${SMB_RAW_REPO_FILE_URL}" --recursive --skip-existing "${ROOT}/src" + + # Setup catkin workspace + catkin init --workspace "${ROOT}" &>/dev/null + + # Generate buildlist for catkin config + # NOTE: catkin build will only build the packages themselve listed in the buildlist but not their dependencies + # so we need to generate a buildlist of packages that are recursively dependent on the packages we want to build + # NOTE: The input to the script is a list of top-level packages to build and the output is the complete list of packages to build + # NOTE: You can use the `scripts/list_top_level_packages.sh` script to list the top level packages in the workspace + # CAUTION: This script should be run after the workspace is created and the repositories are cloned as it uses the workspace to generate the buildlist + BUILD_PKG_LIST=$(python3 "${ROOT}/.devcontainer/generate_catkin_buildlist.py" --workspace "${ROOT}" \ + catkin_simple \ + smb_exploration \ + smb_gazebo \ + smb_mission_planner \ + smb_mpc \ + smb_msf \ + smb_msf_graph \ + smb_path_planner \ + object_detection \ + ) + + # Split the string into an array of package names to pass to catkin config as positional arguments + IFS=' ' read -r -a BUILD_PKGS_ARRAY <<< "${BUILD_PKG_LIST}" + + # Configure the workspace + catkin config --workspace "${ROOT}" \ + --extend /opt/ros/noetic \ + --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -- \ + --buildlist "${BUILD_PKGS_ARRAY[@]}" +else + echo "Workspace already exists. Skipping cloning and configuring the workspace." + echo "If you want to re-clone the repository, please remove the 'src' folder and rebuild the workspace." +fi \ No newline at end of file From d8215874ca02ecf4d5d5aacfb89b739b4b90612d Mon Sep 17 00:00:00 2001 From: Fu Zhengyu Date: Fri, 28 Jun 2024 16:25:22 +0000 Subject: [PATCH 4/7] new connect-smb alias --- .devcontainer/setup_alias.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.devcontainer/setup_alias.sh b/.devcontainer/setup_alias.sh index 7bddfbf..735a78e 100644 --- a/.devcontainer/setup_alias.sh +++ b/.devcontainer/setup_alias.sh @@ -19,9 +19,11 @@ setup_alias_in_zsh "wssetup" "source ${ROOT}/devel/setup.zsh" setup_alias_in_bash "wssetup" "source ${ROOT}/devel/setup.bash" ## Setup alias for other commands -## Example: define ROS_MASTER_URI and ROS_IP for connecting to SMB 263 -## The ip address of every SMB is 10.0.x.5 where x is the last digit of SMB Robot Number. Example: For SMB 263 the on-board computer IP address is 10.0.3.5 -setup_alias_in_shell "connect-smb263" "export ROS_MASTER_URI=http://10.0.3.5:11311 && export ROS_IP=$(hostname -I | awk '{print $1}')" +## Example: define ROS_MASTER_URI and ROS_IP for connecting to SMB +## It will automatically set ROS_MASTER_URI to the IP address of the SMB NUC and ROS_IP to the IP address of the host machine +## based on the default gateway IP address (the IP address of the router on the SMB) +## Note: The ip address of every SMB is 10.0.x.5 where x is the last digit of SMB Robot Number. Example: For SMB 261 the on-board computer IP address is 10.0.1.5 +setup_alias_in_shell "connect-smb" "export ROS_MASTER_URI=http://\$(ip route show default | grep -oP 'via \K\d+\.\d+\.\d+').5:11311 ; export ROS_IP=\$(ip route get 8.8.8.8 | grep -oP '(?<=src )\S+') ; echo 'ROS_MASTER_URI and ROS_IP set to ' ; printenv ROS_MASTER_URI ; printenv ROS_IP" # Catkin build memory & job limit setup_alias_in_shell "build-limit" "catkin build --jobs 8 --mem-limit 70%" From bd95278f2318b3f538875a419338f144eb8ef93c Mon Sep 17 00:00:00 2001 From: Fu Zhengyu Date: Fri, 28 Jun 2024 17:42:04 +0000 Subject: [PATCH 5/7] add pane title to tmux --- .tmux.conf | 6 +++--- scripts/start_smb_tmux.sh | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 41f8f5b..690d360 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -6,9 +6,9 @@ set -g default-terminal "screen-256color" setw -g allow-rename off setw -g automatic-rename off -## Change prefix key to C-a, easier to type, same to "screen" -# unbind C-b -# set -g prefix C-a +# Enable pane title +set -g pane-border-format "#{pane_index} #{pane_title}" +set -g pane-border-status bottom # Enable mouse support set -g mouse on diff --git a/scripts/start_smb_tmux.sh b/scripts/start_smb_tmux.sh index d76078b..1f1b9ae 100644 --- a/scripts/start_smb_tmux.sh +++ b/scripts/start_smb_tmux.sh @@ -22,6 +22,11 @@ else tmux split-window -h tmux split-window -v + # Set the title of each pane + tmux select-pane -t $SESSION_NAME:0.0 -T "Gazebo" + tmux select-pane -t $SESSION_NAME:0.1 -T "Object Detection" + tmux select-pane -t $SESSION_NAME:0.2 -T "Custom Command" + # Send the command to panes tmux send-keys -t $SESSION_NAME:0.0 'wssetup && roslaunch smb_gazebo sim.launch launch_gazebo_gui:=true keyboard_teleop:=true' tmux send-keys -t $SESSION_NAME:0.1 'wssetup && roslaunch object_detection object_detection.launch gpu:=off' From 9e59826e6d3a0f81e7fc68d99b4f449b75a424e9 Mon Sep 17 00:00:00 2001 From: Fu Zhengyu Date: Fri, 28 Jun 2024 19:21:31 +0000 Subject: [PATCH 6/7] fix: add top-level packages to generate_catkin_buildlist.py --- .devcontainer/generate_catkin_buildlist.py | 3 ++- .devcontainer/post-create.sh | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.devcontainer/generate_catkin_buildlist.py b/.devcontainer/generate_catkin_buildlist.py index 6c3a6a3..0ca951c 100644 --- a/.devcontainer/generate_catkin_buildlist.py +++ b/.devcontainer/generate_catkin_buildlist.py @@ -22,9 +22,10 @@ def main(): args = parser.parse_args() top_level_packages = args.packages - all_build_packages = set() + all_build_packages = set(top_level_packages) for pkg in top_level_packages: all_build_packages |= generate_dependencies(pkg) + all_build_packages = sorted(all_build_packages) print(" ".join(all_build_packages).lstrip()) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index a2cacea..7d6653d 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -43,8 +43,6 @@ if [ ! -d "${ROOT}/src" ]; then smb_exploration \ smb_gazebo \ smb_mission_planner \ - smb_mpc \ - smb_msf \ smb_msf_graph \ smb_path_planner \ object_detection \ From 1c3e2fb1965a3de1573217f3b8a50618b4c3c9e9 Mon Sep 17 00:00:00 2001 From: Fu Zhengyu Date: Fri, 28 Jun 2024 17:44:02 +0000 Subject: [PATCH 7/7] release 1.2.0 --- CHANGELOG.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7062146..a0e9b30 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,4 +7,14 @@ Changelog 1.1.0 (2024-06-26) -------------- -* Change `matplotlib` backend to `Qt5Agg` to avoid `tkinter` dependency \ No newline at end of file +* Change `matplotlib` backend to `Qt5Agg` to avoid `tkinter` dependency + +1.2.0 (2024-06-28) +-------------- +* Comment out `initializeCommand` in `.devcontainer/devcontainer.json` to avoid always pulling the image +* Add `.devcontainer/devcontainer-lock.json` to lock the feature version +* Add `connect-smb` alias in `.devcontainer/setup_alias.sh` +* Add shell completion for `vcs` +* Do not clone repositories and configure workspace if `src` exists +* Add pane title for `tmux` +* fix: add top-level packages to `.devcontainer/generate_catkin_buildlist.py` \ No newline at end of file