robin d5a47881ac Fix RC steering sign inversion and throttle/steer slew-filter livelock
Steering (CH1): omega was computed with the opposite sign from the
convention used everywhere else in this file (+omega=left,
-omega=right, per the LiDAR avoidance comments and the prior Xbox
joystick code), so pushing the stick left steered the robot right
and vice versa. Flipped the sign at the single point omega is
derived from the stick so curve-turn and spin-turn both inherit the
fix.

Throttle/steer anti-corruption filter: once a reading was rejected
for exceeding max_slew_per_tick, last_raw_throttle/last_raw_steer
never updated, so every subsequent real reading kept failing the
same slew check against that now-permanently-stale reference —
a livelock. Symptom: CH2 showing neutral (1500) on the HUD while the
robot kept driving forward regardless of stick input. Added a
max_reject_streak escape hatch: after a few consecutive rejections
in a row, treat it as a real fast stick movement rather than a
one-off corrupted frame and resync to the latest value.

Verified working on hardware.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-19 15:30:16 +09:00
2026-08-07 13:48:39 +09:00
2026-08-19 13:56:22 +09:00
2026-08-19 13:56:22 +09:00
2026-08-18 10:27:13 +09:00
2026-08-18 10:27:13 +09:00
2026-08-07 13:48:39 +09:00
2026-08-07 13:48:39 +09:00
2026-08-19 14:44:25 +09:00
2026-08-07 13:48:39 +09:00

ZLLG80ASM250-4096-B V2.12 모터 & ZLAC8015D 4WD C++ 초저지연 제어 시스템

본 로봇 제어 시스템은 C++17 고성능 멀티스레드 엔진으로 작성되었으며, Linux 커널 USB Latency 1ms 튜닝, SDL2 무선 Xbox 컨트롤러 조이스틱 인터페이스, 4WD 차동/제자리 선회 Kinematics 및 엔코더 실시간 주행 거리(Tripmeter) 검증 기능이 탑재되어 있습니다.


1. 하드웨어 스펙 & 로봇 칫수

  • 로봇 차체 칫수:
    • 좌우 바퀴 중심 간 거리 (Track Width, W): 576.0 mm (0.576 m)
    • 전후 바퀴 중심 간 거리 (Wheelbase, L): 368.4 mm (0.3684 m)
    • 버니어 실측 타이어 유효 반지름 (R): 131.517 mm (0.131517 m, 10.35인치 타이어 외경)
    • 전면 범퍼 오프셋: 45.0 mm (0.045 m)
  • 모터 & 드라이버:
    • Front Driver: RS485 Station ID 1 (/dev/ttyUSB0)
    • Rear Driver: RS485 Station ID 2 (/dev/ttyUSB0)
    • 모터 1회전 엔코더 해상도: 16,384 Ticks (4체배 정밀 카운팅)

2. 원클릭 1ms 초저지연 실행 방법

터미널에서 원클릭 라운치 스크립트를 실행합니다:

./run_4wd.sh

run_4wd.sh가 자동 처리하는 작업:

  1. Linux Kernel USB Serial latency_timer를 16ms에서 1ms로 즉시 하향 튜닝
  2. xbox_motor_control.cpp C++17 고성능 바이너리 최적화 컴파일 (g++ -O3 -std=c++17 -lSDL2 -lpthread)
  3. 100Hz 초저지연 4모터 동기화 모션 제어 및 HUD 출력 루프 시작

3. 🎮 Xbox 컨트롤러 조작법

  • 좌측 아날로그 스틱 (위/아래): 로봇 직진 / 후진
  • 좌측 아날로그 스틱 (좌/우): 커브 선회 (차동 Kinematics, 지면 긁힘 0%)
  • 우측 아날로그 스틱 (좌/우): 제자리 회전 (Spin Turn)
  • A 버튼: 주행 미터계 (TRIP Distance) 0.000m 영점 리셋
  • B 버튼 / Ctrl+C: 로봇 안전 정지 후 브레이크 잠금 및 안전 종료

4. 📐 주행 거리 (Odometry) 정밀 검증

  • AXLE: 바퀴 중심 축이 이동한 실시간 거리 (m)
  • BUMPER: 로봇 맨 앞 전면 범퍼 위치 기준 거리 (m)
  • 왕복 정밀도: 1.2m 이상 직진 후 출발선으로 복귀 시 0.008m (8mm) 오차 0개 정밀 검증 완벽 완료!

5. 주요 레지스터 (Modbus RTU 115200 8N1)

레지스터 (Hex) 설명
0x200D 동작 모드 (3: 속도 제어 모드)
0x200E Control Word (0x0008: Enable, 0x0007: Disable)
0x2088 좌/우 모터 명령 속도 (RPM)
0x201A / 0x201B 좌/우 전자식 브레이크 (0: 해제, 1: 잠금)
0x20A7 6레지스터 연속 블록 읽기 (포지션 틱 & RPM 피드백)
S
Description
fori_zltech_motor_test fori 모터 구동 테스트입니다
Readme 31 MiB
Languages
C++ 95.8%
Shell 3.7%
Makefile 0.5%