Because of the bumper restrictions this year, my team has opted to do a “below-bumper” intake. What we’ve done for extra height is moved the motors from the bottom of the modules to the top like so:
What would I have to change in our swerve module configuration code to facilitate this new orientation?
Here’s the current configs I’m using:
SwerveModule::SwerveModule(const int driveMotorID, const int angleMotorID, const int angleEncoderID, double magnetOffset)
: m_driveMotor{driveMotorID}, m_angleMotor{angleMotorID}, m_angleEncoder{angleEncoderID} {
driveMotorConfig.Slot0.WithKP(Drivetrain::Swerve::PID::Motor::Drive::P);
driveMotorConfig.Slot0.WithKI(Drivetrain::Swerve::PID::Motor::Drive::I);
driveMotorConfig.Slot0.WithKD(Drivetrain::Swerve::PID::Motor::Drive::D);
driveMotorConfig.MotorOutput.WithNeutralMode(ctre::phoenix6::signals::NeutralModeValue::Brake);
driveMotorConfig.Feedback.WithFeedbackSensorSource(ctre::phoenix6::signals::FeedbackSensorSourceValue::RotorSensor);
m_driveMotor.GetConfigurator().Apply(driveMotorConfig);
angleMotorConfig.Slot0.WithKP(Drivetrain::Swerve::PID::Motor::Angle::P);
angleMotorConfig.Slot0.WithKI(Drivetrain::Swerve::PID::Motor::Angle::I);
angleMotorConfig.Slot0.WithKD(Drivetrain::Swerve::PID::Motor::Angle::D);
angleMotorConfig.MotorOutput.WithNeutralMode(ctre::phoenix6::signals::NeutralModeValue::Brake);
angleMotorConfig.Feedback.WithSensorToMechanismRatio(1);
angleMotorConfig.Feedback.WithRemoteCANcoder(m_angleEncoder);
angleMotorConfig.ClosedLoopGeneral.ContinuousWrap = true;
m_angleMotor.GetConfigurator().Apply(angleMotorConfig);
angleEncoderConfig.WithMagnetOffset(magnetOffset);
angleEncoderConfig.WithAbsoluteSensorRange(ctre::phoenix6::signals::AbsoluteSensorRangeValue::Unsigned_0To1);
m_angleEncoder.GetConfigurator().Apply(angleEncoderConfig);
m_turningPIDController.EnableContinuousInput(0_deg, 360_deg);
}
I’ve been thinking it might be as simple as adding the line:
driveMotorConfig.MotorOutput.WithInverted(ctre::phoenix6::signals::InvertedValue::CounterClock>wise_Positive);
But I don’t know how that would affect our odometry