Quote:
Originally Posted by kinganu123
I apologize if I'm looking at this wrong way, but it seems rather simple from my understanding.
Code:
Servos[1-4].set(joystick.getDirectionDegrees());
Motors[1-4].set(joystick.getMagnitude+/-joystick.getTwist());
|
Assuming "servos" are the steering motors, it looks like you are pointing all the wheels in the same direction. Here on CD that's usually referred to Crab drive, not swerve.
With the motors, it looks like you are trying to do skid-steer.
So, it looks like Crab Drive with skid steering.
Quote:
|
Of course you'll need to do some adjusting for the servos and a the twist, but I think that's all that needs to be done.
|
The problem of figuring out the theoretically correct speed and steering angle for each of the 4 wheels for any given desired vehicle motion is called "inverse kinematics". The derivation of the formulas for this is interesting but not beyond the reach of high school mathematics. The formulas themselves are straightforward.
If you could make each wheel instantaneously go to its theoretically correct speed and steering angle, swerve would be simple. But there are dynamics involved. It takes time to steer the wheel and change its speed. During this transition time, the vehicle may do unexpected and/or undesired things.
So the real problem in implementing a competent swerve drive is how to control each wheel to obtain predictable operation and acceptable response to driver commands. There are threads (and technical papers) discussing this problem.