Quote:
Originally Posted by ekapalka
How do your drivers control it? Could you explain the code a bit? What did your team do to overcome the "180 degree problem" described in the first comment in this thread?
|
Just a forewarning I did not code our swerves, but I do understand (for the most part) how the code works. The majority of the code was written by a junior on the team who basically immersed himself in all things swerve once we actually started fabricating our first modules. With that said I'll do my best to answer your question.
We have three joysticks on the control board, but only two joysticks (the main driver's left and right stick) control the swerve. The left stick controls the direction the wheels are facing for translating as well as the speed the robot is moving at. The right stick causes the robot to pinwheel (turn in place) by both orienting the wheels to be tangent to the circular path it is moving about as well as controlling the speed of the wheels as the robot turns. When you manipulate the two joysticks in parallel one of the speeds (I believe the greater of the left and right stick) takes precedence, and depending on your manipulation of the joysticks, allows you to preform maneuvers such as sweep turns, pirouettes, etc. Any time you take your hands off the sticks or let the joysticks return to their "zeroed-out" position, the wheels return to their original orientation of facing straight forwards relative to the robot.
As far as the "180 degree problem," I'm assuming you're asking about the "dead zone" and minimizing "bad behavior"
Quote:
Originally Posted by Ether
The second "180 problem" I am looking at is more difficult: if the drivetrain does not have unlimited steering, or if the sensors have have gaps (dead zone). The design goal is to minimize the "bad behavior" around the discontinuity. One approach might be to build some smarts into the control algorithm so that it looks for opportunities to steer the wheels away from the discontinuity whenever doing so would be least disruptive (for example when speeds are very low).
|
We don't really minimize the "bad behavior" of the swerves. We mainly just address the "dead zone" issue. The pseudo-code for overcoming the "180 degree problem" looks something like 'if the module rotates too far towards the dead stops (or "dead zones" as Ether calls them), rotate the module 180 degrees away from the dead stop and reverse the driving direction of the wheel.' Essentially if we were to try to make it preform a maneuver that required more than the 330 degrees provided, such as pirouetting continuously, every so often the robot would have a slight pause in its motion while the modules realigned themselves.