View Single Post
  #5   Spotlight this post!  
Unread 11-10-2011, 10:54 AM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Help with Swerve Drive Programming??

Quote:
Originally Posted by kinganu123 View Post
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.






Last edited by Ether : 11-10-2011 at 11:24 AM.
Reply With Quote