|
Moderating Acceleration / Deceleration
This is one of those problems that "should" be easy conceptually. For some reason though, we are really strugging with it. Yesterday we spent about 3 hours trying to write code that would moderate our acceleration and deceleration to prevent "rocking" the robot off the front and back wheels.
Here is our thought. From a dead stand-still, flooring the outputs in either forward or reverse does not cause a problem. However, if you are already moving forward or backward, flooring the outputs the opposite direction creates a "wheelie" followed by a slam as the robot comes down. (Yesterday we blew apart a muffin fan we came down so hard).
So we check to see if there is a difference in joysticks of more than 50, AND we check to see if the joysticks are pointing in the direction opposite of the old motion. But it doesn't seem to work.
The code we are using is attached. Aside from the fact that this doesn't work, it seems very kludgey. Can someone point us in the right direction, or perhaps take a quick look at the code and tell us where we might be going wrong?
|