[wpimath] Reorganize LinearSystem factories (#8468)

This commit is contained in:
Tyler Veness
2026-01-12 19:09:35 -08:00
committed by GitHub
parent 89d0759ef2
commit 00fa8361dd
108 changed files with 1808 additions and 2138 deletions

View File

@@ -12,10 +12,10 @@ import org.wpilib.math.numbers.N1;
import org.wpilib.math.numbers.N2;
import org.wpilib.math.numbers.N7;
import org.wpilib.math.random.Normal;
import org.wpilib.math.system.DCMotor;
import org.wpilib.math.system.LinearSystem;
import org.wpilib.math.system.Models;
import org.wpilib.math.system.NumericalIntegration;
import org.wpilib.math.system.plant.DCMotor;
import org.wpilib.math.system.plant.LinearSystemId;
import org.wpilib.math.util.Nat;
import org.wpilib.math.util.StateSpaceUtil;
import org.wpilib.math.util.Units;
@@ -77,7 +77,7 @@ public class DifferentialDrivetrainSim {
double trackwidth,
Matrix<N7, N1> measurementStdDevs) {
this(
LinearSystemId.createDrivetrainVelocitySystem(
Models.differentialDriveFromPhysicalConstants(
driveMotor, mass, wheelRadius, trackwidth / 2.0, j, gearing),
driveMotor,
gearing,
@@ -91,10 +91,9 @@ public class DifferentialDrivetrainSim {
*
* @param plant The {@link LinearSystem} representing the robot's drivetrain. This system can be
* created with {@link
* org.wpilib.math.system.plant.LinearSystemId#createDrivetrainVelocitySystem(DCMotor, double,
* org.wpilib.math.system.Models#differentialDriveFromPhysicalConstants(DCMotor, double,
* double, double, double, double)} or {@link
* org.wpilib.math.system.plant.LinearSystemId#identifyDrivetrainSystem(double, double,
* double, double)}.
* org.wpilib.math.system.Models#differentialDriveFromSysId(double, double, double, double)}.
* @param driveMotor A {@link DCMotor} representing the drivetrain.
* @param gearing The gearingRatio ratio of the robot, as output over input. This must be the same
* ratio as the ratio used to identify or create the drivetrainPlant.