update @huiyu

This commit is contained in:
NuoDaJia02
2026-03-06 16:45:11 +08:00
parent 7bbb1395b1
commit 1912c4d5bd
10 changed files with 65 additions and 17 deletions

5
.gitmodules vendored
View File

@@ -24,4 +24,7 @@
url = ssh://git@47.110.133.3:2222/HiveCoreRD/hivecore_robot_interfaces.git
[submodule "hivecore_robot_ctrlgui"]
path = hivecore_robot_ctrlgui
url = ssh://git@47.110.133.3:2222/HiveCoreRD/hivecore_robot_ctrl_gui.git
url = ssh://git@47.110.133.3:2222/HiveCoreRD/hivecore_robot_ctrl_gui.git
[submodule "hivecore_robot_system"]
path = hivecore_robot_system
url = ssh://git@47.110.133.3:2222/HiveCoreRD/hivecore_robot_system.git

View File

@@ -6,6 +6,9 @@
# ./kill_robot.sh -n # dry run (show PIDs only)
# ./kill_robot.sh -y # no confirmation
# ./kill_robot.sh -v # verbose logs
# ./kill_robot.sh -x node1,node2 # exclude nodes (do not kill)
# ./kill_robot.sh except node1 node2 # kill all except these nodes
# ./kill_robot.sh all -x rm_arm_node,vision_node # example: kill all except listed nodes
set -Eeuo pipefail
@@ -16,6 +19,7 @@ DRY_RUN=false
ASSUME_YES=false
VERBOSE=false
TARGET_NODES=()
EXCLUDE_NODES=()
log() { echo "[kill_ros2] $*"; }
vlog() { $VERBOSE && echo "[kill_ros2][debug] $*" || true; }
@@ -40,6 +44,20 @@ while [[ $# -gt 0 ]]; do
VERBOSE=true
shift
;;
-x|--exclude)
shift
[[ $# -gt 0 ]] || { echo "Error: --exclude requires a value"; exit 1; }
IFS=',' read -r -a _excl <<<"$1"
EXCLUDE_NODES+=(${_excl[@]})
shift
;;
except)
shift
while [[ $# -gt 0 ]]; do
EXCLUDE_NODES+=($1)
shift
done
;;
-h|--help)
echo "Usage: $0 [OPTIONS] [NODE_NAMES... | all]"
echo " all Kill ALL ROS 2 nodes associated with workspace (default behavior if no nodes specified AND 'all' is passed)"
@@ -49,6 +67,8 @@ while [[ $# -gt 0 ]]; do
echo " -n, --dry-run Print PIDs that would be killed, but don't kill them"
echo " -y, --yes Skip confirmation prompt"
echo " -v, --verbose Enable verbose logging"
echo " -x, --exclude LIST Comma-separated node names/keywords to exclude"
echo " except NODES... Exclude nodes (kill all except these)"
exit 0
;;
*)
@@ -59,13 +79,21 @@ while [[ $# -gt 0 ]]; do
done
if [ ${#TARGET_NODES[@]} -eq 0 ] && [ "$SCOPE_ALL" = false ]; then
echo "Error: No target nodes specified. Please provide node names or use 'all'."
echo "Usage: $0 [node1 node2 ...] | all"
exit 1
if [ ${#EXCLUDE_NODES[@]} -gt 0 ]; then
TARGET_NODES=("all")
else
echo "Error: No target nodes specified. Please provide node names or use 'all'."
echo "Usage: $0 [node1 node2 ...] | all"
exit 1
fi
fi
if [[ "${#TARGET_NODES[@]}" -eq 1 && "${TARGET_NODES[0]}" == "all" ]]; then
log "Mode: KILL ALL workspace nodes"
if [[ ${#EXCLUDE_NODES[@]} -gt 0 ]]; then
log "Mode: KILL ALL workspace nodes except: ${EXCLUDE_NODES[*]}"
else
log "Mode: KILL ALL workspace nodes"
fi
TARGET_NODES=() # Clear target list to trigger full workspace kill logic
# Falls through to existing logic
elif [[ ${#TARGET_NODES[@]} -gt 0 ]]; then
@@ -80,11 +108,15 @@ Options:
-n, --dry-run Dry run (list candidate PIDs and commands)
-y, --yes Assume yes (no confirmation prompt)
-v, --verbose Verbose output
-x, --exclude Comma-separated node names/keywords to exclude
-h, --help Show this help and exit
Arguments:
all Kill ALL ROS 2 nodes associated with workspace
NODE_NAMES... List of node executable names or keywords to kill
except NODES... Exclude nodes (kill all except these)
Examples:
$(basename "$0") all -x rm_arm_node,vision_node
EOF
}
@@ -122,6 +154,18 @@ list_candidates() {
$match_found || continue
fi
# --- Exclude specific node names if provided ---
if [[ ${#EXCLUDE_NODES[@]} -gt 0 ]]; then
local exclude_hit=false
for excl in "${EXCLUDE_NODES[@]}"; do
if grep -q "$excl" <<<"$cmd"; then
exclude_hit=true
break
fi
done
$exclude_hit && continue
fi
# Scope filter
local in_scope=false
if $SCOPE_ALL; then

View File

@@ -4,14 +4,15 @@
#DRIVER|launch|ethercat_control|ethercat_node.launch.py|
#DRIVER|run|led_dev|led_dev_node|
#MOTOR|run|motor_dev|motor_dev_node|
#IMU|launch|imu_dev|imu_dev.launch.py|
ARM|launch|rm_arm_control|rm_arm_control.launch.py|
MOTOR|run|motor_dev|motor_dev_node|
IMU|launch|imu_dev|imu_dev.launch.py|
# ARM|launch|rm_arm_control|rm_arm_control.launch.py|
ARM|launch|dual_arm_action_server|dual_arm_action_server.launch.py|
IMG|launch|img_dev|img_dev.launch.py|
TOOL|run|ctrlgui|ctrlgui_node|
VISION|launch|vision_detect|medical_sense.launch.py|
GRIPPER|launch|gripper_dev|gripper_dev.launch.py|
BRAIN|launch|brain|brain.launch.py|
#MOTION|launch|robot_control|robot_control.launch.py|
MOTION|launch|robot_control|robot_control.launch.py|
VOICE|launch|robot_speaker|voice.launch.py|
VOICE|run|robot_speaker|skill_bridge_node|
TOOL|launch|ctrlgui|ctrlgui.launch.py|