Has anyone figured out a method of using AdvantageKit with yagsl? I’ve been trying to work something out since id really like to use AK but don’t have a desire to make my own swerve library when there’s already an existing and solid library
Look at the example projects on AdvantageKit’s repository. They have a swerve implementation there.
Our team is using YAGSL with AdvantageKit this year. Here is our robots github repo. GitHub - WindingMotor/SwerveDriveAdvantage2024: Repo for NEO MK4i swerve modules with YAGSL and AdvantageKit implementation. Robot code for 2106 2024 season. Fully commented with javadoc support!
I wouldn’t do this as this doesn’t give a lot of control over the swerve during replay. Implementing swerve with advantage kit by yourself is pretty hard, but there are many good examples
It shouldn’t be too difficult to modify YAGSL to accommodate AdvantageKit but I won’t support it or do it bc AdvantageKit requires some modification from user code which violates the principal of YAGSL being a library
Do you think there’s a way to do it with just extending / encapsulation, or would I need to actually dig into the code and modify it in a fork
You should be able to just extend/modify the wrappers. Maybe modify the updateTelemtry
function to include motor power output current, but that should be it. It requires a fork bc i never tried to make it fully featured (again mosy of the user base wouldn’t need it or want it)
The problem i’m seeing is replacing the modules in swervedrive with IO objects, maybe I just need to fully extend SwerveDrive
You shouldn’t need to? I have sim objects for everything already. The motor controller wrappers act as IO wrappers as well, no?
Oh damn im dumb, yeah you’re right, I did the swervedrive wrapper and it was acting funky (in sim the drive velocities were wrong, like different for each wheel wrong)
If you have any idea why my states are looking like this I’d appreciate it, it makes no sense imo im not even touching those, but I just checked the repo I copied from and it works fine there.
Heres my code: https://github.com/falOn-Dev/YAGSL-AdvantageKit
Did you have any luck getting this working?
Just wondering, what are any key differences between YAGSL and the base swerve project from advantage kit?
YAGSL uses JSON files to configure the swerve and supports basically any possible configuration in FRC.
Adding onto some examples of swerve with AdvantageKit, feel free to check out our robot code for this season. We primarily do this with PurpleLib, which wraps common hardware such as motor controllers to log sensor values, with the wrappers acting as a low-effort, drop-in replacements. Using these wrappers in the robot code allowed us to gain and implement some fairly extensive logging data (such as our for our wrappers for Spark Max controllers being used in our MAX Swerve module class).
Here are some pictures if you are curious:
Having that wrapper is a really cool idea which pretty much makes advantage kit easy, I love it!
I suppose the only reason our team didn’t do it is because it’s easier to incorporate simulation with the normal known structure of advantage kit.
As a point of comparison, YAGSL does the same thing and has configurable telemetry and default logging for an advantagescope compatible format for a swerve widget.
The wrappers are infinitely useful and will allow for future expansion as new products come out very easily. They also clearly outline the minimum requirements for new products as the evolve.
We automatically log at the motor controller level, meaning that all this logging data is automatically made available for all mechanisms, not just the swerve drivetrain. It eliminates the need to create all the “IO” classes that AdvantageKit typically recommends.
Not that hard to do simulation with our wrapper class, you can set what the inputs should be in each subsystem’s simulationPeriodic()
method.