Ramsete command

Do you have to use wpilib DifferentialDrive with ramsete command? I am trying to use it without DifferentialDrive, but it is shaking violently.

github is here: https://github.com/phlogiston1/frc-3461-2020

We had this problem and lowering our pid constants solved it (not the ramsete .7 and 2; the others)

are you using wpilib DifferentialDrive?

Yes : https://github.com/frc4123/Pleasworkrobt/tree/master/src/main/java/frc/robot

Thank you. It turns out that DifferentialDrive is MANDATORY for using ramsetcommand… There goes 2.5 hours of my life. Anyway, using your code for reference, I was able to implement differentialDrive and the robot no longer has seizures.

1 Like

Uh… no it isn’t. You can use whatever method of setting the motor outputs you want. However, if you have a DifferentialDrive instance laying around and don’t set the outputs, MotorSafety will stop the motors. You can either not make an instance of DifferentialDrive, call SetSafetyEnabled(false) on it, or use DifferentialDrive to set the motor controllers.

2 Likes

But you still need to create an instance of DifferentialDrive, otherwise RamseteCommand does weird things. I just changed my code so that it can use differentialDrive, and everything seems to work.

can you set it to false in auto for an actual competition and re-enable it during tele op?

Sure, or you can keep it enabled and periodically call feed() in auto to feed the motor safety.

I do call feed but I still get the error

No, you don’t. You probably had an implementation error in your custom drive code.

2 Likes

Thank you, you’re probably right. It works now, but out of curiosity, does anyone have an example of how to use RamseteCommand without DifferentialDrive?

public class ExampleDifferentialDrive extends SubsystemBase {
  private final var m_feedforward
      = new SimpleMotorFeedforward(kS, kV, kA);

  private final var m_kinematics
      = new DifferentialDriveKinematics(kTrackwidth);

  private final var m_leftMotors
      = new SpeedControllerGroup(
          new Spark(kLeftMotors[0]),
          new Spark(kLeftMotors[1]));

  private final var m_rightMotors
      = new SpeedControllerGroup(
          new Spark(kRightMotors[0]),
          new Spark(kRightMotors[1]));

  public ExampleDifferentialDrive() {
    m_rightMotors.setInverted(true);
  }

  public void arcadeDrive(double fwdVel, double rotVel) {
    var wheelSpeeds = m_kinematics.toWheelSpeeds(
        new ChassisSpeeds(fwdVel, 0, rotVel));

    m_leftMotors.setVoltage(
        m_feedforward.calculate(wheelSpeeds.leftMetersPerSecond));

    m_rightMotors.setVoltage(
        m_feedforward.calculate(wheelSpeeds.rightMetersPerSecond));
  }

  public void tankDriveVolts(double left, double right) {
    m_leftMotors.setVoltage(left);
    m_rightMotors.setVoltage(right);
  }
}

plus assorted methods for encoders and gyro and whatever

2 Likes

thanks

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