YAGSL is intended to be an easy implementation of a generic swerve drive that should work for most square swerve drives. The project is documented on here. The JSON documentation can also be found here
This example is intended to be a starting place on how to use YAGSL. By no means is this intended to be the base of your robot project. YAGSL provides an easy way to generate a SwerveDrive which can be used in both TimedRobot and Command-Based Robot templates.
Vendor URL:
https://broncbotz3481.github.io/YAGSL-Lib/yagsl/yagsl.json
Javadocs here
Library here
Code here
WIKI
Config Generation
We will be actively montoring this and fix any issues when we can!
YAGSL-Example
. YAGSL
and YAGSL-Lib
are updated on a nightly
basis.deploy
└── swerve
├── controllerproperties.json
├── modules
│ ├── backleft.json
│ ├── backright.json
│ ├── frontleft.json
│ ├── frontright.json
│ ├── physicalproperties.json
│ └── pidfproperties.json
└── swervedrive.json
import java.io.File;
import edu.wpi.first.wpilibj.Filesystem;
import swervelib.parser.SwerveParser;
import swervelib.SwerveDrive;
import edu.wpi.first.math.util.Units;
SwerveDrive swerveDrive=new SwerveParser(new File(Filesystem.getDeployDirectory(),"swerve")).createSwerveDrive(Units.feetToMeters(14.5));
wheelDiamter
, gearRatio
, encoderPulsePerRotation
from physicalproperties.json
optimalVoltage
to physicalproperties.json
maxSpeed
and optimalVoltage
from swervedrive.json
conversionFactor
for BOTH the drive and steering motor in
the modules configuration JSON file. IF one of the motors is the same as the rest of the swerve
drive and you want to use that conversionFactor
, set the conversionFactor
in the module JSON
configuration to 0.SwerveDrive
through new SwerveParser(directory).createSwerveDrive(maximumSpeed);
conversionFactor
in swervedrive.json
. You can pass it into the
constructor as a parameter like thisdouble DriveConversionFactor = SwerveMath.calculateMetersPerRotation(Units.inchesToMeters(WHEEL_DIAMETER), GEAR_RATIO, ENCODER_RESOLUTION);
double SteeringConversionFactor = SwerveMath.calculateDegreesPerSteeringRotation(GEAR_RATIO, ENCODER_RESOLUTION);
SwerveDrive swerveDrive = new SwerveParser(directory).createSwerveDrive(maximumSpeed, SteeringConversionFactor, DriveConversionFactor);
Without the debugging and aid of Team 7900 the project could never be as stable or active as it is.