Files
2026-07-23 17:55:52 +08:00

30 lines
958 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 启动真机 LinkerHand ROS2 SDKO6 左手 / can0
set -eo pipefail
WS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/linker_hand_ros2_sdk_ws"
# ROS setup.bash 会引用未定义变量,不能开 nounset (-u)
set +u
source /opt/ros/jazzy/setup.bash
source "$WS/install/setup.bash"
set -u
export ROS_DOMAIN_ID="${ROS_DOMAIN_ID:-30}"
export ROS_LOCALHOST_ONLY=0
# 开启 CAN(需 sudo;蓝灯常亮)
if ! ip link show can0 &>/dev/null; then
echo "[warn] 未检测到 can0,请插入 USB-CAN 后执行:"
echo " sudo ip link set can0 up type can bitrate 1000000"
else
if ! ip link show can0 | grep -q 'UP'; then
echo "[info] 尝试拉起 can0 ..."
sudo ip link set can0 up type can bitrate 1000000 || true
fi
fi
echo "启动: ros2 launch linker_hand_ros2_sdk linker_hand.launch.py"
echo "配置: hand_type=left hand_joint=O6 can=can0"
set +u
exec ros2 launch linker_hand_ros2_sdk linker_hand.launch.py "$@"