Quote:
Originally Posted by teku14
Doesn't this procedure make it so that even the slightest input will give full throttle? I mean sure it scales it appropriately now but What if you only wanted the wheels to run at say 0.1, 0.05, 0.05 ? Now this scales it to 1, 0.5, 0.5
|
It won't scale 0.1, .05, .05 at all. If you run GeeTwo's scaling function with these three numbers, biggest comes out equal to 1.0, and you divide all three wheel speeds by 1. The scaling will only happen if one wheel is over 1 (or under -1).
GeeTwo's code:
Code:
biggest = max(1.0, abs(wheel1), abs(wheel2) ,abs(wheel3))
wheel1 = wheel1 / biggest
wheel2 = wheel2 / biggest
wheel3 = wheel3 / biggest