YAGSL-Example
YAGSL-Example copied to clipboard
Remove `SwerveController` in favor of command in user side.
SwerveController adds unnecessary complexity to YAGSL and is no longer required. It should be replaced with a function which controls the robot heading via a ProfiledPIDController.
I have finally figured out how i want to do this!
I will remove SwerveController in favor of another utility SwerveControl which will be able to generate translatiom2d and angular velocity to be passed to SwerveDrive.
The ideal usecase would be as follows.
ControllerWrapper driver = new ControllerWrapper(xboxController);
SwerveControl ctr = new SwerveControl();
...
ctr
.withAngularVelocity(driver::getAngularVelocity) // For angular velocity control.
.withHeading(driver::getHeading) // For heading control
.withTranslation2d(driver::getTranslation2d)
.withHeadingPID(new ProfiledPIDController())
.withHeadingOverride(trigger, ()->{return angle;})
swerveDrive.drive(ctr::getTranslation2d, ctr::getAngularVelocity)