|
Re: Automatic 2 Speed Drivetrain Shifting Code
We've never used one in competition, but I have a basic idea of how to get started. It's helpful to have a simple functions that approximates the fps of each joystick value. You want to be continuously checking for certain parameters that would cause shifting, so set up code to measure the speed of the wheels and also the acceleration. You need to make sure that you wait 1 second between shifts, and that you don't end up shifting while the driver is turning. The most useful is if somebody starts pushing you, and you need to shift to the slow gear to push them away. This can be detected if the actual speed of the robot is >10% away from where the joysticks are and if the average deceleration over the last second or so exceeds a certain amount. The problem with this is when the drivers hit a wall, it shifts into high gear and wears down the gear. Also, I've never tried it, but it may be possible to reach the max speed faster if you start in one gear, then shift up. If you want to try this, I would try starting with code that puts you in your slow gear when you are traveling slowly, and something that puts you in high gear if it detects that the driver has commanded a speed faster than a certain constant.
|