Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/update-image.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@ on:
paths:
- Dockerfile
- .github/workflows/update-image.yml
- .script/template/
- .script/build-rmcs-cross
- rmcs_ws/toolchain.cmake

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
[submodule "rmcs_ws/src/fast_tf"]
path = rmcs_ws/src/fast_tf
url = https://github.com/qzhhhi/FastTF.git
[submodule "rmcs_ws/src/rmcs_auto_aim_v2"]
path = rmcs_ws/src/rmcs_auto_aim_v2
url = https://github.com/Alliance-Algorithm/rmcs_auto_aim_v2.git
71 changes: 71 additions & 0 deletions .script/autoaim-debug
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash

set -euo pipefail

SESSION="autoaim-debug"

usage() {
cat <<'EOF'
Usage: autoaim-debug <local|remote>

local Start autoaim debug tmux session locally.
remote Start autoaim debug tmux session on ssh remote.
EOF
}

write_start_script() {
local path="$1"
cat >"${path}" <<'SCRIPT'
set -euo pipefail

SESSION="autoaim-debug"

if [[ -f "${HOME}/env_setup.bash" ]]; then
ENV_SETUP="${HOME}/env_setup.bash"
elif [[ -f "/root/env_setup.bash" ]]; then
ENV_SETUP="/root/env_setup.bash"
else
echo "env_setup.bash not found in \$HOME or /root" >&2
exit 1
fi

tmux kill-session -t "${SESSION}" 2>/dev/null || true

tmux new-session -d -s "${SESSION}" -n "foxglove" \
"bash -lc 'source \"${ENV_SETUP}\" && ros2 launch foxglove_bridge foxglove_bridge_launch.xml'"

tmux new-window -t "${SESSION}" -n "streamer" \
"bash -lc '/opt/autoaim/bin/start-streamer'"
SCRIPT
chmod +x "${path}"
}

if [[ $# -ne 1 ]]; then
usage
exit 1
fi

case "$1" in
local)
tmp=$(mktemp)
trap 'rm -f "${tmp}"' EXIT
write_start_script "${tmp}"
bash "${tmp}"
tmux has-session -t "${SESSION}"
echo "autoaim-debug local started in tmux session: ${SESSION}"
echo "Attach with: tmux attach -t ${SESSION}"
;;
remote)
tmp=$(mktemp)
trap 'rm -f "${tmp}"' EXIT
write_start_script "${tmp}"
scp -q "${tmp}" remote:/tmp/autoaim-debug-start.sh
ssh-remote "bash /tmp/autoaim-debug-start.sh && rm -f /tmp/autoaim-debug-start.sh && tmux has-session -t ${SESSION}"
echo "autoaim-debug remote started in tmux session: ${SESSION}"
echo "Attach with: ssh-remote \"tmux attach -t ${SESSION}\""
;;
*)
usage
exit 1
;;
esac
22 changes: 22 additions & 0 deletions .script/complete/_local-context
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
#compdef local-context

_arguments \
'1:key:(game_stage robot_health robot_bullet)' \
'2:value:->value'

case "$state" in
value)
case "${words[2]}" in
game_stage)
_values 'game stage' \
not_start \
preparation \
referee_check \
countdown \
started \
settling \
unknown
;;
esac
;;
esac
22 changes: 22 additions & 0 deletions .script/complete/_remote-context
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
#compdef remote-context

_arguments \
'1:key:(game_stage robot_health robot_bullet)' \
'2:value:->value'

case "$state" in
value)
case "${words[2]}" in
game_stage)
_values 'game stage' \
not_start \
preparation \
referee_check \
countdown \
started \
settling \
unknown
;;
esac
;;
esac
33 changes: 29 additions & 4 deletions .script/host/rmcs
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,19 +6,24 @@ readonly DEVELOPER_NAME="ubuntu"
readonly NVIM_PATH="/opt/nvim/bin/nvim"
readonly NVIM_PORT=6666
readonly NVIM_HOST="localhost"
readonly RMCS_PATH="/workspaces/RMCS/"

function show_help() {
local project_dir="$1"
local service="$2"
echo "Usage: $(basename "$0") [path] [zsh|n|nvim|neovide|vim|ide]"
echo "Usage: $(basename "$0") [path] [zsh|recreate|n|nvim|neovide|vim|ide|ai]"
echo " Project dir: $project_dir"
echo " Service: $service"
}

function setup_container() {
docker compose up -d --no-recreate
}

function rmcs_zsh() {
local service="$1"
echo "Starting and entering container..."
docker compose up -d
setup_container
docker compose exec "$service" zsh
}

Expand All@@ -29,7 +34,7 @@ function rmcs_nvim() {
local port=$NVIM_PORT

echo "Starting container..."
docker compose up -d
setup_container

echo "Checking available port and starting nvim headless server..."
while nc -z "$NVIM_HOST" "$port" 2>/dev/null; do
Expand All@@ -38,7 +43,7 @@ function rmcs_nvim() {
done

echo "Starting nvim server on port $port..."
docker compose exec -u "$DEVELOPER_NAME" -d "$service" \
docker compose exec -u "$DEVELOPER_NAME" -w "$RMCS_PATH" -d "$service" \
"$NVIM_PATH" --headless --listen "$NVIM_HOST:$port"

for i in $(seq 1 $timeout); do
Expand All@@ -60,6 +65,20 @@ function rmcs_nvim() {
fi
}

function rmcs_recreate() {
echo "Recreating container..."
docker compose up -d --force-recreate
}

function rmcs_ai() {
local service="$1"
local agent="${RMCS_AGENT:-opencode}"
echo "Starting container and launching Agent ($agent)..."
setup_container
docker compose exec -u "$DEVELOPER_NAME" -w "$RMCS_PATH" "$service" \
zsh -ic "exec ${agent}"
}

function main() {
local project_dir command

Expand All@@ -84,9 +103,15 @@ function main() {
zsh)
rmcs_zsh "$service"
;;
recreate)
rmcs_recreate
;;
n | nvim | neovide | vim | ide)
rmcs_nvim "$service"
;;
ai)
rmcs_ai "$service"
;;
*)
show_help "$project_dir" "$service"
;;
Expand Down
Loading