Migration From 2023 CTRE API To 2024

Hello,

I’m the programming lead for Team 599. I’m developing our swerve code this year and we’re using am having trouble finding the 2024 equivalent of the following commands:

  1. swerveCANCoderConfig.sensorTimeBase = SensorTimeBase.PerSecond;
  2. swerveDriveFXConfig.initializationStrategy = SensorInitializationStrategy.BootToZero;
  3. m_AngleMotor.set(ControlMode.Position, degreesToFalcon(angle));
  4. m_DriveMotor.set(ControlMode.Velocity, velocity, DemandType.ArbitraryFeedForward, voltageFeedForward);

Currently I have simpleMotorFeedforwards running as replacements for commands 3 and 4, but I’m not entirely sure if it’ll work. I was thinking of setting the motor position to 0 upon initializing to address command 2, but I’m not sure how to work around/replace command 1.

These commands will be used in the HardwareConfig.java and SwerveModule.java files in the DriveTrain branch.

I’ve linked our 2024 code below:
https://github.com/Robodox-599/2024_UnnamedBot

Any help is much appreciated!

I also could not find anything on SensorTimeBase.

For the InitializationStrategy, the Talon FX and CANcoder sensors are always initialized to their absolute position in Phoenix 6. reference:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.