|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#20
|
|||
|
|||
|
Re: Drivetrain PID tuning
Quote:
angle = (right_distance - left_distance) / width distance = (left_distance + right_distance) / 2 You can do a similar transform for your powers (pardon any sign errors) to get back to actual outputs you physically have. left_voltage = distance_voltage - turn_voltage right_voltage = distance_voltage + turn_voltage This then lets you control what you care about. In the presence of tire slip and tire wear, you won't always go straight with just encoders. A gyro has a different set of issues (noise), but isn't affected by those problems. So, we use the gyro for the angle of the robot instead of computing the angle as above. Just re-phrasing your loops to be an angle, distance pair of loops has huge benefit. Unless your robot has all it's mass perfectly centered over the two drive wheels, your left, right PID loop won't be able to do good distance control and turn control without compromises. I tend to find that good distance control results in a small amount of turn chatter and oscillation. (You can work out the physics to show that the two sides are coupled in left, right, but not in angle, distance) A angle, distance loop doesn't make that assumption. If you really want to do left, right with a gyro, you can reverse the equations above. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|