Files
huoyi_deploy/src/invicta_deploy/scripts/smoke_test.sh
T
caowangrenbo 594885b9e8 feat(hardware): 接入 SocketCAN 与智身模组协议,补温度诊断和指令看门狗
- hardware: 新增 can_bus.h / joint_module_protocol.h,实现使能/失能/运行帧与
  12 字节反馈帧编解码;ReadHardware/WriteHardware 落地,控制字按协议语义映射
  (kErrorReset 按重新使能处理,kGetStatus 无需请求)
- hardware: 温度/驱动状态/电压经 /joint_diagnostics 发布(默认 10 Hz,可配置)
- hardware: 指令看门狗,100 ms 无指令转阻尼,避免上游挂掉后重发最后一帧
- hardware: 限幅与归一化边界分离——[joint_limits] 是唯一实际限幅,加载期校验
  其不超过 [motor.*] 的归一化边界;力矩按峰值扭矩夹紧,kp/kd 越界夹紧并告警
- hardware: require_can 开关,无 CAN 时可只发状态(冒烟测试用)
- remote: 1002/4 关节按 M20 的 16 槽上报(swing→HipY、wheel→Wheel,其余占位 0),
  1002/5 温度改由 /joint_diagnostics 提供
- deploy: 启动时序等订阅者出现再发(ROS1 无 latch,否则整段丢失)
- msgs: 新增 JointDiagnostics
- docs: 智身模组 CANFD 协议整理、待办清单
2026-10-22 11:05:49 +08:00

69 lines
2.4 KiB
Bash
Executable File
Raw 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
# 无硬件冒烟测试:拉起 roscore + invicta_hardware(骨架)+ invicta_deploy,
# 检查话题、频率、参数是否按预期工作。需要先 catkin_make 并 source devel/setup.bash。
#
# source /opt/ros/noetic/setup.bash && source devel/setup.bash
# bash src/invicta_deploy/scripts/smoke_test.sh # 或任意路径下调用本脚本
set -u
WS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" # scripts -> invicta_deploy -> src -> ws
cd "$WS_DIR" || exit 1
echo "=== 1. onnxruntime 动态库解析 ==="
ldd devel/lib/invicta_deploy/invicta_deploy | grep -i onnx || echo "!! libonnxruntime.so 未解析,检查 CMakeLists 的 RPATH"
echo "=== 2. 启动 roscore ==="
nohup roscore >/tmp/roscore.log 2>&1 &
sleep 8
echo "=== 3. 启动 invicta_hardware(require_can:=false:无 CAN 时只发零位状态)==="
nohup roslaunch invicta_hardware invicta_hardware.launch require_can:=false >/tmp/hw.log 2>&1 &
sleep 4
echo "--- 话题 ---"
rostopic list
echo "--- /joint_states 频率(期望 ~200 Hz)---"
timeout 5 rostopic hz /joint_states 2>&1 | tail -2
echo "--- /joint_states 样例 ---"
timeout 5 rostopic echo -n1 /joint_states 2>&1 | sed -n '1,12p'
echo "--- /imu/data 样例 ---"
timeout 5 rostopic echo -n1 /imu/data 2>&1 | sed -n '1,18p'
echo "=== 4. 启动 invicta_remote(协议节点)==="
nohup roslaunch invicta_remote invicta_remote.launch >/tmp/remote.log 2>&1 &
sleep 3
python3 "$WS_DIR/src/invicta_remote/scripts/protocol_udp_test.py" --port 30000 --steer 0.2,0,0.1 --motion 1 >/tmp/proto_test.log 2>&1
tail -4 /tmp/proto_test.log
echo "=== 5. 启动 invicta_deploy(RL 节点)==="
nohup roslaunch invicta_deploy invicta_deploy.launch >/tmp/dep.log 2>&1 &
sleep 8
echo "--- /joint_commands 频率(idle 状态期望 ~200 Hz)---"
timeout 5 rostopic hz /joint_commands 2>&1 | tail -2
echo "--- 配置是否读到(TOML)---"
grep -aE "^\[config\]" /tmp/dep.log | head -3
echo "--- 节点连接关系 ---"
rosnode info /invicta_deploy 2>&1 | sed -n '1,14p'
echo "--- /motion_state 频率(期望 ~20 Hz)---"
timeout 4 rostopic hz /motion_state 2>&1 | tail -2
echo "=== 6. 日志 ==="
echo "--- invicta_deploy ---"
tail -35 /tmp/dep.log
echo "--- invicta_remote ---"
tail -12 /tmp/remote.log
echo "--- invicta_hardware ---"
tail -8 /tmp/hw.log
pkill -f roslaunch >/dev/null 2>&1
pkill roscore >/dev/null 2>&1
sleep 1
echo "=== 冒烟测试结束 ==="