More work bringing 2026 into 2027, ignoring errors for pos/vel conversion factor for now

This commit is contained in:
2026-10-04 22:03:41 -04:00
parent d036299528
commit e9a164a276
24 changed files with 1635 additions and 12 deletions

View File

@@ -0,0 +1,38 @@
package first.robot.utilities;
import java.util.function.DoubleSupplier;
import org.wpilib.command2.Command;
import org.wpilib.command2.SubsystemBase;
import org.wpilib.hardware.bus.CANPort;
import com.revrobotics.spark.SparkLowLevel.MotorType;
import com.revrobotics.spark.SparkMax;
/**
* A simple subsystem that can be used to test a single SparkMax and associated NEO motor
*/
public class SparkMAXTester extends SubsystemBase {
private SparkMax spark;
/**
* Constructor
*
* @param deviceID The CAN ID of the SparkMAX that needs testing
*/
public SparkMAXTester(CANPort canPort, int deviceID) {
spark = new SparkMax(canPort, deviceID, MotorType.kBrushless);
}
/**
* Sets the speed of the motor
*
* @param speed A method or lambda which returns a double between -1 and 1
* @return A Command object that runs indefinitely to control motor speed
*/
public Command setSpeed(DoubleSupplier speed) {
return run(() -> {
spark.setThrottle(speed.getAsDouble());
});
}
}