### Author Topic: Swerve drive equations  (Read 9164 times)

#### Louis L

• Hero Member
• Posts: 569
##### Swerve drive equations
« on: January 09, 2017, 11:46:41 PM »
Unlike mecanum, there is no built-in support for swerve drive in WPIlib or LabVIEW. Here's where you can find some information:
https://www.chiefdelphi.com/media/papers/2426

#### Brayden L

• Guest
##### Re: Swerve drive equations
« Reply #1 on: January 13, 2017, 06:48:31 PM »
Specifically the file titled first and second files in the link, titled Calculate Swerve Wheel Speeds and Steering Angles and Derivation - Inverse Kinematics for Swerve (the first one is better for integrating straight into code, second one shows how it works)

#### Vanshika C

• Guest
##### Re: Swerve drive equations
« Reply #2 on: January 14, 2017, 05:14:48 PM »
There's conflicting information on these documents. The "Derivation - Inverse Kinematics for Swerve" pdf says that the calculation of A, B, C, and D is:

Code: [Select]
`A = STR - RCW * L/2B = STR + RCW * L/2C = STR - RCW * W/2D = STR + RCW * W/2`
, but the "Calculate Swerve Wheel Speeds and Steering Angles" pdf says it's:
Code: [Select]
`A = STR - RCW * L/RB = STR + RCW * L/RC = STR - RCW * W/RD = STR + RCW * W/R`
My own calculations and math agree with the 1st pdf. I can upload a picture of my work if you'd like.
Anyone testing the swerve calculator on the spreadsheet will have to change the formulas for A, B, C, and D as they use the 2nd pdf's formulas.

#### Vanshika C

• Guest
##### Re: Swerve drive equations
« Reply #3 on: January 14, 2017, 05:36:49 PM »
Also, here's my code for the swerve drive equations in C++. You can compare the results with those of the spreadsheet, just be sure to change the formulas for A, B, C, and D first. Also, this is just test code so the documentation isn't great :/
« Last Edit: January 14, 2017, 05:38:53 PM by Vanshika C »

#### Louis L

• Hero Member
• Posts: 569
##### Re: Swerve drive equations
« Reply #4 on: January 15, 2017, 09:26:07 PM »
Interesting. I haven't had time to go over those equations yet. Will try and get to them tomorrow.