Skip to content

Commit 6311624

Browse files
committed
pre-release
1 parent 5db953b commit 6311624

9 files changed

+123
-55
lines changed

.devcontainer/Dockerfile

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ FROM $BASE_IMAGE
66
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
77
&& apt-get -y install --no-install-recommends \
88
x11-apps \
9-
x11-utils \
10-
mesa-utils \
11-
gnome-terminal \
9+
usbutils \
1210
&& rm -rf /var/lib/apt/lists/*
1311

1412
ARG VNC_RESOLUTION

.devcontainer/devcontainer.json

+9-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
"configureZshAsDefaultShell": true
2626
},
2727
"ghcr.io/devcontainers/features/git:1": {},
28-
// "ghcr.io/devcontainers/features/desktop-lite:1": {
29-
// "password": "robotx"
30-
// }
28+
"ghcr.io/devcontainers/features/desktop-lite:1": {
29+
"password": "robotx"
30+
}
3131
},
3232
"forwardPorts": [
3333
6080,
@@ -43,6 +43,9 @@
4343
"onAutoForward": "silent"
4444
}
4545
},
46+
"otherPortsAttributes": {
47+
"onAutoForward": "ignore"
48+
},
4649
"containerUser": "robotx",
4750
"initializeCommand": "docker pull ghcr.io/ethz-robotx/rss_workspace:main",
4851
"postCreateCommand": "bash ./.devcontainer/post-create.sh",
@@ -53,7 +56,9 @@
5356
"redhat.vscode-xml",
5457
"ms-vscode.cpptools-extension-pack",
5558
"eamodio.gitlens",
56-
"mhutchie.git-graph"
59+
"mhutchie.git-graph",
60+
"ms-python.python",
61+
"tombonnike.vscode-status-bar-format-toggle"
5762
]
5863
}
5964
}
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/python3
2+
3+
# This script generates a buildlist for catkin config
4+
# Input: List of top-level packages to build
5+
# Output: List of packages to build
6+
7+
import argparse
8+
import re
9+
from subprocess import check_output
10+
from typing import Set
11+
12+
def generate_dependencies(package_name: str) -> Set[str]:
13+
deps_raw = check_output(["catkin", "list", "--rdeps", "-u", package_name])
14+
dependencies = re.findall(r'(?<=- ).*?(?=\n|$)', deps_raw.decode())
15+
dependencies = set(dependencies)
16+
return dependencies
17+
18+
def main():
19+
parser = argparse.ArgumentParser(description="Generate a buildlist for catkin config")
20+
parser.add_argument("packages", nargs="+", help="List of top-level packages to build")
21+
parser.add_argument("--workspace", default=".", help="Path to the catkin workspace")
22+
args = parser.parse_args()
23+
top_level_packages = args.packages
24+
25+
all_build_packages = set()
26+
for pkg in top_level_packages:
27+
all_build_packages |= generate_dependencies(pkg)
28+
all_build_packages = sorted(all_build_packages)
29+
print(" ".join(all_build_packages).lstrip())
30+
31+
if __name__ == "__main__":
32+
main()

.devcontainer/generate_catkin_skiplist.py

-37
This file was deleted.

.devcontainer/post-create.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,15 @@ fi
2626
vcs import --input "${SMB_RAW_REPO_FILE_URL}" --recursive --skip-existing "${ROOT}/src"
2727

2828
# Setup catkin workspace
29-
catkin init --workspace "${ROOT}"
29+
catkin init --workspace "${ROOT}" &>/dev/null
3030

31-
# Generate skiplist for catkin config
32-
# TODO: Add the packages to build in the list below
31+
# Generate buildlist for catkin config
3332
# NOTE: catkin build will only build the packages themselve listed in the buildlist but not their dependencies
34-
# so we need to generate a skiplist to skip the packages that are not recursively dependent on the packages we want to build
35-
# NOTE: The input to the script is a list of packages to build and the output is the list of packages to skip
33+
# so we need to generate a buildlist of packages that are recursively dependent on the packages we want to build
34+
# 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
3635
# NOTE: You can use the `scripts/list_top_level_packages.sh` script to list the top level packages in the workspace
37-
# CAUTION: This script should be run after the workspace is created and the repositories are cloned as it uses the workspace to generate the skiplist
38-
SKIP_PKG_LIST=$(python3 "${ROOT}/.devcontainer/generate_catkin_skiplist.py" --workspace "${ROOT}" \
36+
# 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
37+
BUILD_PKG_LIST=$(python3 "${ROOT}/.devcontainer/generate_catkin_buildlist.py" --workspace "${ROOT}" \
3938
catkin_simple \
4039
smb_exploration \
4140
smb_gazebo \
@@ -44,14 +43,15 @@ SKIP_PKG_LIST=$(python3 "${ROOT}/.devcontainer/generate_catkin_skiplist.py" --wo
4443
smb_msf \
4544
smb_msf_graph \
4645
smb_path_planner \
46+
object_detection \
4747
)
4848

4949
# Split the string into an array of package names to pass to catkin config as positional arguments
50-
IFS=' ' read -r -a SKIP_PKGS_ARRAY <<< "${SKIP_PKG_LIST}"
50+
IFS=' ' read -r -a BUILD_PKGS_ARRAY <<< "${BUILD_PKG_LIST}"
5151

5252
# Configure the workspace
5353
catkin config --workspace "${ROOT}" \
5454
--extend /opt/ros/noetic \
5555
--cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -- \
56-
--skiplist "${SKIP_PKGS_ARRAY[@]}"
56+
--buildlist "${BUILD_PKGS_ARRAY[@]}"
5757

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
.zsh_history
33
devel/
44
logs/
5-
build/
5+
build/
6+
7+
# ignore rosbags
8+
bags/
9+
**/*.bag

.tmux.conf

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ==========================
2+
# === General settings ===
3+
# ==========================
4+
5+
set -g default-terminal "screen-256color"
6+
setw -g allow-rename off
7+
setw -g automatic-rename off
8+
9+
## Change prefix key to C-a, easier to type, same to "screen"
10+
# unbind C-b
11+
# set -g prefix C-a
12+
13+
# Enable mouse support
14+
set -g mouse on
15+
16+
# Prompt to rename window right after it's created
17+
set-hook -g after-new-window 'command-prompt -I "#{window_name}" "rename-window '%%'"'
18+
19+
# Reload tmux configuration
20+
bind C-r source-file ./.tmux.conf \; display "Config reloaded"
21+
22+
# Toggle snycronized panes
23+
bind C-s setw synchronize-panes \; display "Synchronize panes is #{?pane_synchronized,on,off}"

.vscode/settings.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,16 @@
1919
"src/misc/mav_comm",
2020
"src/misc/eigen_catkin",
2121
"src/misc/yaml_cpp_catkin"
22-
]
22+
],
23+
"terminal.integrated.profiles.linux": {
24+
"smb-tmux": {
25+
"path": "zsh",
26+
"args": [
27+
"${workspaceFolder}/scripts/start_smb_tmux.sh",
28+
"smb"
29+
],
30+
"icon": "piano",
31+
"color": "terminal.ansiYellow"
32+
}
33+
}
2334
}

scripts/start_smb_tmux.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# if [ "$#" -ne 1 ]; then
4+
# echo "Usage: $0 <session_name>"
5+
# exit 1
6+
# fi
7+
8+
SESSION_NAME="${1:-smb_tmux}"
9+
10+
ROOT=$(dirname "$(dirname "$(readlink -f $0)")")
11+
TMUX_CONFIG="${ROOT}/.tmux.conf"
12+
13+
# Check if a tmux session named "smb_tmux" already exists
14+
if tmux has-session -t $SESSION_NAME 2>/dev/null; then
15+
# If the session exists, attach to it
16+
tmux attach-session -t $SESSION_NAME
17+
else
18+
# If the session doesn't exist, create a new one and load the config file
19+
tmux -f $TMUX_CONFIG new-session -d -s $SESSION_NAME
20+
21+
# Split the window into three panes
22+
tmux split-window -h
23+
tmux split-window -v
24+
25+
# Send the command to panes
26+
tmux send-keys -t $SESSION_NAME:0.0 'wssetup && roslaunch smb_gazebo sim.launch launch_gazebo_gui:=true keyboard_teleop:=true'
27+
tmux send-keys -t $SESSION_NAME:0.1 'wssetup && roslaunch object_detection object_detection.launch gpu:=off'
28+
tmux send-keys -t $SESSION_NAME:0.2 'wssetup && command'
29+
30+
# Attach to the new session
31+
tmux attach-session -t $SESSION_NAME
32+
fi

0 commit comments

Comments
 (0)