ed34e1c0254df1730266599ce52f575f31ff0edf
Previously, once a wheel's airborne flag cleared, its target reverted to the normal drive command but the actual RPM still had to ramp up through the gentle standstill-launch accel_rate/jerk profile. Since the chassis is already moving at that point (unlike a stop-start), the wheel spent several hundred ms unable to match ground speed, dragging/grinding against the surface and occasionally landing on a momentarily negative curve-turn target, making it spin backward. Track the airborne->grounded transition per wheel and, on the tick it clears, snap cmd directly to target and reset the jerk accel state instead of ramping, so the wheel rejoins the other three immediately. Verified working on hardware. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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)
- 좌우 바퀴 중심 간 거리 (Track Width,
- 모터 & 드라이버:
- Front Driver: RS485 Station ID 1 (
/dev/ttyUSB0) - Rear Driver: RS485 Station ID 2 (
/dev/ttyUSB0) - 모터 1회전 엔코더 해상도:
16,384 Ticks(4체배 정밀 카운팅)
- Front Driver: RS485 Station ID 1 (
2. ⚡ 원클릭 1ms 초저지연 실행 방법
터미널에서 원클릭 라운치 스크립트를 실행합니다:
./run_4wd.sh
run_4wd.sh가 자동 처리하는 작업:
- Linux Kernel USB Serial latency_timer를 16ms에서 1ms로 즉시 하향 튜닝
xbox_motor_control.cppC++17 고성능 바이너리 최적화 컴파일 (g++ -O3 -std=c++17 -lSDL2 -lpthread)- 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 피드백) |
Description
Languages
C++
95.8%
Shell
3.7%
Makefile
0.5%