binaryProgramming

Choosing a swerve Library

Programming a swerve drive from scratch can be difficult we highly recommend one of the following swerve libraries to make swerve as functional as it can be.

Specifications needed for programming

Swerve drive systems are complicated systems that only work if everything is correct. Make sure you input the correct values for your library.

circle-info

Units may be different for your library

Name
Value

Wheel Diameter

2.5"

Drive Ratio (Mid)

4 to 1

Drive Ratio (High)

3.25 to 1

Steering Ratio

28 to 1

Drive Motors Inverted

False

Steer Motors Inverted

False

Module Positions

The swerve library will need to know where the swerve module is from the center point of the robot. Instead of guessing we can do some basic math to calculate where the center point of each module is from the center.

If you are using one of the open corner variants of the drive corner the center of the wheel is 1.875" from the outer edges of the frame. If we know the outer dimensions of the robot we can calculate the position from the center of the robot to the center of the wheel.

PositionfromCenterX=(LengthOfRobotX/2)1.875Position from Center X = (Length Of Robot X/2)-1.875
PositionfromCenterY=(LengthOfRobotY/2)1.875Position from Center Y = (Length Of Robot Y/2)-1.875

If you are using one of the closed corner variants of the drive corner the center of the wheel is 2.875" from the outer edges of the frame. If we know the outer dimensions of the robot we can calculate the position from the center of the robot to the center of the wheel.

PositionfromCenterX=(LengthOfRobotX/2)2.875Position from Center X = (Length Of Robot X/2)-2.875
PositionfromCenterY=(LengthOfRobotY/2)2.875Position from Center Y = (Length Of Robot Y/2)-2.875
circle-exclamation

Once you have these numbers most swerve libraries want them in coordinate form. Make sure that your values have the right signs.

Corner
X
Y

Front Left (Port Bow)

+

+

Front Right (Starboard Bow)

+

-

Back Left (Port Stern)

-

+

Back Right (Starboard Stern)

-

-

Taken from YAGSL Docs with permission

Wheel Offsets

The way we designed our sensors and the drive corners lets us define what the offsets are going to be. Since the target is always above the miter gear and the angle of the sensor is defined by the plate all you need to know to find the offsets is the orientation of your modules in your robot. Follow the image below to find your offsets for your modules. The red arrows indicate the direction of the wires coming out of the sensor.

circle-info

Some swerve libraries/motor controllers pass in analog signals as -180 to +180 where 0 degrees is half voltage instead of 0 to 360 degrees where 0 is 0 volts. We have included both offset types. YAGSL with spark max's use 0-360.

circle-exclamation

Starting Motor Values

These are our recommended starting values when tuning your Drive Corners. Through testing, we've determined that these values are optimal for a robot at max weight of 115lbs (not including bumpers and batteries)

Steering/Azimuth

Steer Motor
Neo
Kraken x44
Minion
Cu42

Current Limit

30 Amps

30 Amps

30 Amps

P

.04

I

.00001

D

0

FF

0

Ramp Rate

0

0

0

0

Drive

Drive Motor
Neo
Neo Vortex
Kraken x60
Cu60

Current Limit

50

50

50

50

P

I

D

FF

Ramp Rate

.05

.05

triangle-exclamation

Last updated