YAGSL-Example icon indicating copy to clipboard operation
YAGSL-Example copied to clipboard

Remove `SwerveController` in favor of command in user side.

Open thenetworkgrinch opened this issue 1 year ago • 1 comments

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.

thenetworkgrinch avatar May 03 '24 15:05 thenetworkgrinch

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)

thenetworkgrinch avatar Nov 01 '24 15:11 thenetworkgrinch