9a97cf9022
IMU integration (WitMotion HWT905-RS232, doc/06-imu-integration-plan.md): - Phase 1: raw accel/gyro/angle observation, power-on-relative yaw offset - Phase 2: x,y odometry + wheel-vs-IMU omega residual, using a self-fused heading (wheel encoder omega + raw gyro_z average) instead of the IMU's own onboard fused yaw, which field logs showed disagreeing with its own raw gyro sign ~30% of the time during turns - Phase 3: straight-line heading-hold PI trim, active only when steering is centered and no lidar dodge is in progress, capped and field-tuned - Phase 4: whole-body slip detection (commanded vs IMU-measured omega ratio) that temporarily scales down v_x/omega, independent of the per-wheel current-based diagnostics - Phase 5a: k_skid/effective_w replaced with values fitted from real wheel-vs-IMU logs (0.406->0.51, 0.684->0.87) instead of the geometric formula, which field data showed under-driving every turn RC receiver: switched from ttyUSB* guessing to udev-stable device names (ttyMOTOR/ttyRC/ttyIMU), wired through run_4wd.sh and set_low_latency.sh. Motor driver: read motor/driver temperature registers (0x20A4/0x20B0) for proactive overheat visibility in the HUD/CSV. Control fixes: - Airborne-wheel zeroing no longer applies during spin turns, where reaction-torque-driven diagonal load transfer was misclassified as wheels leaving the ground and cutting spin torque in half - jerkLimitedStep's instant-acceleration path now only fires for same-direction speed increases; sign reversals (RC noise/deadzone jitter near a stop, or a genuine direction change) go through the jerk-limited path instead of snapping across zero Auto CSV logging (logs/, gitignored) extended with encoder ticks, IMU, odometry, heading-hold, slip, and temperature columns for field analysis. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
27 lines
1.0 KiB
Bash
Executable File
27 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Linux USB Serial Low Latency Setup Script
|
|
PORT="${1:-/dev/ttyUSB0}"
|
|
|
|
if [ ! -e "$PORT" ]; then
|
|
echo "[오류] 포트 $PORT 가 존재하지 않습니다."
|
|
exit 1
|
|
fi
|
|
|
|
# /dev/ttyMOTOR 같은 udev 고정 심볼릭 링크로 넘어올 수 있으므로, sysfs 조회에
|
|
# 필요한 실제 장치명(ttyUSB0 등)으로 반드시 풀어준다 — 안 그러면
|
|
# /sys/bus/usb-serial/devices/ttyMOTOR 경로가 존재하지 않아 항상 폴백으로 샌다.
|
|
DEV_NAME=$(basename "$(readlink -f "$PORT")")
|
|
LATENCY_PATH="/sys/bus/usb-serial/devices/$DEV_NAME/latency_timer"
|
|
|
|
if [ -f "$LATENCY_PATH" ]; then
|
|
OLD_VAL=$(cat "$LATENCY_PATH")
|
|
echo "$OLD_VAL" | sudo tee "$LATENCY_PATH" > /dev/null 2>&1 || echo 1 | sudo tee "$LATENCY_PATH"
|
|
NEW_VAL=$(cat "$LATENCY_PATH")
|
|
echo "[성공] USB 시리얼 포트 $PORT 지연 타이머 변경: ${OLD_VAL}ms -> ${NEW_VAL}ms"
|
|
else
|
|
# setserial fallback
|
|
setserial "$PORT" low_latency 2>/dev/null || true
|
|
echo "[정보] setserial low_latency 명령을 적용했습니다."
|
|
fi
|