It’s pseudo-code for gyro-guided single 2-axis joystick control of a skid-steer robot. The robot turns and goes in the direction commanded. It’s field-centric control for a non-holonomic vehicle, like a 6WD.
I’m looking for a team that would be interested in coding this up and trying it out, and collaborating with me to work out the bugs and add features, either as a learning experience or possibly for competition use.
It seems to work in a simple simulation but I don’t have a good plant model of the vehicle dynamics and no access to target hardware.
Our team has used a variant of your algorithm on several of our robots (primarily to aid in driving in a straight line…especially important the two years we had omni-wheel holonomic drives). Proportional-only control on gyro heading seemed to do a pretty decent job (way better than trying to use gyro rate as the process variable directly).
No paper or presentation (yet?). Mainly due to the fact that I was under the impression that many others had done something like it (though I can’t name any robots in particular off the top of my head).
In general, our implementation only uses the gyro if we detect that the driver is trying to go straight (the X axis of single stick drive is near 0) - when turning, we leave everything up to the driver. Other than that, pretty much the same.
I would imagine you could code up similar functionality using only left and right encoders, and using the delta between each encoder rate as your error (when trying to go straight).
OK, it looks to me like that’s quite a bit different from what I was trying to achieve.
What I posted is intended to make an essentially field-centric driver interface to a skid-steer vehicle: the driver “points” the joystick in a given (field-centric) direction with a given magnitude, and the robot turns and goes in that direction at the commanded speed, viz:
you push the joystick straight forward and the robot turns and heads straight downfield
you pull the joystick straight back and the robot turns around and heads back toward you
you push the joystick to your right and the robot turns and goes straight across the field from left to right
you push the joystick to your left and the robot turns and goes straight across the field from right to left
… or any angle in-between
Optionally (by adding two more lines of code as shown) the robot could limit the required turning to 90 degrees or less by reversing direction. So if the robot was going straight downfield, for example, and the driver then pulled the joystick straight back, instead of turning around the robot would simply reverse direction by reversing the wheel speeds… but if the driver pushed the joystick to the right the robot would still turn and drive to the driver’s right (regardless of the robot’s orientation at the time).
Whether or not this mode of driver interface would be helpful depends on the game being played and the driver’s experience and skill. Using this interface does not, of course, preclude having a robot-centric (or any other) interface available at the press of a button, so it could be used selectively.
I’ve been working on this for a few days now, I. would deffinately appreciate any team that could post their code to auto-orient the robot as an example code for me.
We did this type of control two years ago when we did swerve drive. It worked out reasonably well, but we had some small issues with the gyro drifting a bit every once in awhile.
Our students even did it with two people: one person controlling X/Y, and the other controlling the direction the robot was ‘pointing’. If it wasn’t for the trailer on the back of the robot, I think it would have been pretty cool… but the two drivers ended up making it look like the bot was fighting itself.
We did somewhat the same in a different application: our '09 turrent used the gyro oriented with regards to the driver. It blew the judges away when they could push the joystick in a direction while we rotated the robot on our pit cart and the turrent would stay pointing in the direction the judges were commanding.
We changed the joystick x/y to a polar angle and used that and the gyro with a PID. The only major difference was that we ignored magnitude.