Well we had the robot tripping a bit because it slowed down to fast, managed to fix it.
thanks anyway.
@PatrickW @Kaboomboom3 It there an update planned for 2023 that adds Canivore support and fixes the cancoder absolute value reset bugs. I know many teams including mine have their own versions of the SDS code for those issues. It would be nice to be back on the official releases.
Now that I know more about what the coming season has. SwerveDrivePoseEstimator is getting an update to allow the use use Wheel Positions instead of the velocity estimates in SwerveModuleState. There is a new class called SwerveModulePosition. IF the sds SwerveModule class were updated to provide that it would be a boon for all your customers . Especially given the potential importance of PoseEstimation in the upcoming games due to the use of AprilTags for vision.
Is there a labview version of this?
Hi,
Do we know when SDS is going to be releasing a new code for the 2023 season?
I would strongly recommend that you take a look at 4265’s git hub which implements serve in LabVIEW. Then take a look at their video series on YouTube (look up swerve for LabVIEW).
Our github implements swerve for thrifty serve, but there are a number of ways to implement it.
Also, take a look at ethers original derivation here on chief Delphi to get started.
Or you can look at jsimpso’s LabVIEW library where he implements wpilib for LabVIEW. He has a swerve example I believe (don’t quote me on it).
I strongly advise you not to plan on the SDS library (at least directly) as a dependency for the 2023 season.
It does not actually save much boilerplate code, there is no official word on whether it will continue to be supported, and the library source itself is not written in a way that inspires confidence in its maintainability. On top of that, the exposed swerve API is quite minimal and does not integrate well with feedback control (and so is hard to use for autonomous motion).
This has been on my list to do with our bot. Is there a good example of someones implementation using Falcon500s and Cancoders. Also I would like to use the motor controllers PID for steering.
This is the most often sighted reference example for what you are asking - https://github.com/Team364/BaseFalconSwerve
3847’s swerve code is based off this 364 repo.
Btw, I have updated my fork with the SwerveModulePosition changes - the examples are also updated for the 2023 beta.
Vendordep: https://raw.githubusercontent.com/democat3457/swerve-lib/beta/SdsSwerveLib.json
We just published 3061-lib, which supports MK4 swerve modules with Falcon 500s and CANcoders. It does use the motor controllers for turn and velocity control. It is currently built for the latest 2023 betas and will be updated after kickoff when the first official releases are published.
@gcschmit Thank you for this. THIS IS AWESOME. I’ve been playing with this and it’s amazing. Just started diving into AdvantageScope and the other goodies.
I’ve now spent time with the SDS lib (we used it in 2022 and hacked it to do autonomous with PathPlanner), and spent a week or so with BaseFalconSwerve playing around. 3061-lib is my hands down favorite.
I like the spotless check built into gradle, but I think it should be tied to “git commit” and not to deploying to the robot. You want to fix formatting before checking in code, and not block deploying to the robot. Imagine you’re at worlds with a critical fix and your line was more than 80 characters long and it failed to deploy. Ouch. At the very least spotless check should happen on build, not deploy.
I retract my comment. Trying to get run gradlew spotlessCheck
from a git pre-commit hook script was really painful. I opted to just add build.dependsOn spotlessApply
to gradle.build
and just automatically squash any linting errors every time you build. Never blocking the deploy.
Glad to hear that 3061-lib is helpful. The spotless check can be annoying. There is a code action to run it when a file is saved in .vscode/settings.json, but that doesn’t run when the file is autosaved. I really like your solution of adding spotlessApply to grade.build. I’m going to do that now.
@PatrickW So is this still going to be updated coming into 2023? Otherwise, you should really just mark it as unmaintained or archive the repo. I keep seeing teams try to use it, it breaks because it hasn’t been updated, and then they struggle to get it working.
We’ve downloaded the template and have some issues.
- We had to update import statements for geometry and kinematics as they were moved from wpilibj to math.
- We had to change GenericHID.Hand.xxxx as that constant is not found.
- Now when we download the code its crashing on the roboRio. No clue why we would be calling a method called isRaspbian() from NavX?
- It would be nice to have examples for how to setup MK4 with Neos and CanCoders. We took a stab at MK4SwerveModuleHelper.createNeo shown below. But could not figure out what the method with “configuration” requires for a configuration. Nor where the CanCoder is specified. And where PID’s are specified.
Error Message causing roboRio Swerve Drive Template code to crash
?????? navX-Sensor Java library for FRC ?
????????ERROR ?? 1 ?? Unhandled exception: java.lang.NoSuchMethodError: 'boolean edu.wpi.first.util.RuntimeDetector.isRaspbian()' ?? com.kauailabs.navx.frc.AHRS.<init>(AHRS.java:227) ???
?????? Error at com.kauailabs.navx.frc.AHRS.<init>(AHRS.java:227): Unhandled exception: java.lang.NoSuchMethodError: 'boolean edu.wpi.first.util.RuntimeDetector.isRaspbian()' ?
?????? at com.kauailabs.navx.frc.AHRS.<init>(AHRS.java:227) ?
Our attempt at defining an SDS MK4 Swerve Drive Module using two NEOs and a CanCoder.
m_frontLeftModule = Mk4SwerveModuleHelper.createNeo(
tab.getLayout("Front Left Module",BuiltInLayouts.kList),
GearRatio.L2,
FRONT_LEFT_MODULE_DRIVE_MOTOR,
FRONT_LEFT_MODULE_STEER_MOTOR,
FRONT_LEFT_MODULE_STEER_ENCODER,
FRONT_LEFT_MODULE_STEER_OFFSET);
New import statements.
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.math.kinematics.SwerveDriveKinematics;
import edu.wpi.first.math.kinematics.SwerveModuleState;
Lastly the section calling the NavX has an if statement that returns a 2D Rotation if its calibrated and has no return statement if its not calibrated. What do we return if not calibrated?
public Rotation2d getGyroscopeRotation() {
// FIXME Remove if you are using a Pigeon
//return Rotation2d.fromDegrees(m_pigeon.getFusedHeading());
// FIXME Uncomment if you are using a NavX
//if (m_navx.isMagnetometerCalibrated()) {
// We will only get valid fused headings if the magnetometer is calibrated
return Rotation2d.fromDegrees(m_navx.getFusedHeading());
//}
//
// // We have to invert the angle of the NavX so that rotating the robot counter-clockwise makes the angle increase.
// return Rotation2d.fromDegrees(360.0 - m_navx.getYaw());
}
Please save yourself the trouble and find a different template. This code is effectively unmaintained and very hard to debug.
Yep, like @Amicus1, the SDS template is effectively unmaintained.
The template project is still using 2021 wpilib so it needs to be updated manually, and there are a few deprecated or removed functions.
The specific issue you’re encountering is likely that you’re using a pre-2023 build of navX on 2023 wpilib. The isRaspbian
function was removed this year.
You can check out 364’s base Falcon swerve, I don’t think it’s been updated for 2023, but it should work much better than the SDS template.
I was hoping to have gotten to this point in December of last year, before all the updates started for this year’s game.