Hey guys,
I am working on migrating our phoenix 5 code to phoenix 6 and I’m having trouble figuring out what would be the phoenix 6 equivalent to this:
swerveCanCoderConfig = new CANCoderConfiguration();
swerveCanCoderConfig.absoluteSensorRange =
AbsoluteSensorRange.Unsigned_0_to_360;
swerveCanCoderConfig.sensorDirection =
Constants.Swerve.canCoderInvert;
swerveCanCoderConfig.initializationStrategy =
SensorInitializationStrategy.BootToAbsolutePosition; swerveCanCoderConfig.sensorTimeBase =
SensorTimeBase.PerSecond;
Use config objects now, like all the other devices in Phoenix 6
MagnetSensorConfigs magnetCfg = new MagnetSensorConfigs()
.withMagnetOffset(0)
.withSensorDirection(SensorDirectionValue.Clockwise_Positive)
.withAbsoluteSensorRange(AbsoluteSensorRangeValue.Signed_PlusMinusHalf);
CANcoderConfiguration cfg = new CANcoderConfiguration()
.withMagnetSensor(magnetCfg);
canCoder.getConfigurator().apply(cfg);
1 Like
Ok, thank you so much! It ended up working.