Fix curve-steering wheel-reversal at partial throttle
Steering angular velocity (omega) was scaled by the constant max speed (max_v) instead of the actual current forward speed (v_x). This decoupled turn tightness from throttle position: at low/medium throttle, a moderate left-stick steering input already produced an omega large enough to flip the inner wheel's commanded velocity negative, causing the robot to spin/reverse/lurch forward instead of smoothly curving. Scaling by abs(v_x) keeps turn radius proportional to speed as intended, matching prior full-throttle behavior while fixing the reversal at partial throttle. Also drops the stale committed x86-64 binary (built before this fix, so its behavior no longer matched source). Build fresh on an x86 machine via `make`; run_4wd.sh already rebuilds automatically when the binary is missing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1078,7 +1078,14 @@ int main(int argc, char **argv) {
|
||||
target_rl = v_l * rpm_per_ms;
|
||||
target_rr = -v_r * rpm_per_ms;
|
||||
} else {
|
||||
omega += -lx * (max_v / (effective_w / 2.0f));
|
||||
// 선회 강도(omega)는 반드시 "현재 전진 속도(v_x)"에 비례해야 커브
|
||||
// 반경이 스로틀과 무관하게 일정하게 유지된다. 이전 구현은 상수인
|
||||
// max_v(최고속도)를 기준으로 omega를 계산해서, 저속 주행 중에는
|
||||
// v_x가 작은데도 omega*k_skid 항은 고속 기준 그대로 커서 안쪽
|
||||
// 바퀴(v_l 또는 v_r) 속도 부호가 뒤집혀 후진해버리는 문제가 있었다.
|
||||
// (예: 저속으로 스틱을 왼쪽으로 조금만 꺾어도 로봇이 제자리 회전
|
||||
// 하듯 튀거나 뒤로 갔다 앞으로 갔다 하는 증상)
|
||||
omega += -lx * (std::abs(v_x) / (effective_w / 2.0f));
|
||||
float v_l = v_x - omega * k_skid;
|
||||
float v_r = v_x + omega * k_skid;
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user