mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Also update copyright to include "and other WPILib contributors" and clarify license referral language to not be restricted to FIRST teams.
46 lines
876 B
Java
46 lines
876 B
Java
// Copyright (c) FIRST and other WPILib contributors.
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
package edu.wpi.first.wpilibj;
|
|
|
|
public class MockSpeedController implements SpeedController {
|
|
private double m_speed;
|
|
private boolean m_isInverted;
|
|
|
|
@Override
|
|
public void set(double speed) {
|
|
m_speed = m_isInverted ? -speed : speed;
|
|
}
|
|
|
|
@Override
|
|
public double get() {
|
|
return m_speed;
|
|
}
|
|
|
|
@Override
|
|
public void setInverted(boolean isInverted) {
|
|
m_isInverted = isInverted;
|
|
}
|
|
|
|
@Override
|
|
public boolean getInverted() {
|
|
return m_isInverted;
|
|
}
|
|
|
|
@Override
|
|
public void disable() {
|
|
m_speed = 0;
|
|
}
|
|
|
|
@Override
|
|
public void stopMotor() {
|
|
disable();
|
|
}
|
|
|
|
@Override
|
|
public void pidWrite(double output) {
|
|
set(output);
|
|
}
|
|
}
|