StatusSignal<Double> problem

I have been trying to implement Swerve onto the 2024 version code. I saw that there were a lot of methods from TalonFX were gone. I have several questions, I will list them below:

  1. Since the WPI_TalonFX is removed, now they are using the phoenix6 TalonFX lib, I was trying to find the configFactoryDefault command and was not able to find it. What is it?

  2. Also there are commands gone in CANcoder lib too, I can’t find the configAbsoluteSensorRange and configFactoryDefault. What is it?

  3. Who do I cast or convert the StatuesSignal values to a double?

  4. What is the command to getSelectedSensorPosition and getSelectedSensorVelocity and setSelectedSensorPosition in phoenix6 lib?

I would appreciate anyone finding these things.

  1. To config factory default use: m_motor.getConfigurator().apply(new TalonFXConfiguration());

  2. For absolute sensor range create a cancoder configurator object and set this equal to any of the options in the AbsoluteSensorRangeValue enum: cancoder_config.MagnetSensor.AbsoluteSensorRange
    and setting factory default is the same as it is for the motor.

  3. .getValueAsDouble() converts a status signal to a double

  4. m_motor.getPosition() and m_motor.getVelocity()

Thank you so much for the help.

One more thing, what’s the command for getMotorOutputPercent in for TalonFX?

Not completely sure, maybe getDutyCycle()? All of the TalonFX methods are here CoreTalonFX (CTRE Phoenix 6 Java 24.1.0)

can confirm:

sourced from this extremely useful pdf: https://pro.docs.ctr-electronics.com/_/downloads/en/latest/pdf/
it solved all my migration issues in like 10 minutes

1 Like

It’s probably easier to read on the website:

Here’s the migration guide specifically:

And here’s the full API reference:

If anyone using Swerve on RobotTrajectory, what new command for PPSwerveControllerCommand on new PathPlanner 2.0 lib?

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