mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpimath] LinearSystemSim Constructor and method cleanup (#6502)
Modified Java constructors to take a variable number of measurement std devs argument with checks in place to make sure the right amount (or none) are passed into the constructor. All changes passed down to classes utilizing LinearSystemSim. Removed excess constructors Removed Java and C++ CurrentDrawAmps method as it doesn't belong in a generic (non electrical) linear system. Kept a non override version in all derived electrical classes. Also LinearSystemSim has now been made agnostic to electrical systems. Inputs don't have to be voltage. BatteryVoltage clamp function has been pushed down to electrical subclasses. Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0f45fe9486
commit
ab315e24c8
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.armsimulation.subsystems;
|
||||
|
||||
import edu.wpi.first.math.VecBuilder;
|
||||
import edu.wpi.first.math.controller.PIDController;
|
||||
import edu.wpi.first.math.system.plant.DCMotor;
|
||||
import edu.wpi.first.math.util.Units;
|
||||
@@ -51,8 +50,8 @@ public class Arm implements AutoCloseable {
|
||||
Constants.kMaxAngleRads,
|
||||
true,
|
||||
0,
|
||||
VecBuilder.fill(
|
||||
Constants.kArmEncoderDistPerPulse, 0.0) // Add noise with a std-dev of 1 tick
|
||||
Constants.kArmEncoderDistPerPulse,
|
||||
0.0 // Add noise with a std-dev of 1 tick
|
||||
);
|
||||
private final EncoderSim m_encoderSim = new EncoderSim(m_encoder);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.elevatorexponentialsimulation.subsystems;
|
||||
|
||||
import edu.wpi.first.math.VecBuilder;
|
||||
import edu.wpi.first.math.controller.ElevatorFeedforward;
|
||||
import edu.wpi.first.math.controller.PIDController;
|
||||
import edu.wpi.first.math.system.plant.DCMotor;
|
||||
@@ -60,7 +59,8 @@ public class Elevator implements AutoCloseable {
|
||||
Constants.kMaxElevatorHeightMeters,
|
||||
true,
|
||||
0,
|
||||
VecBuilder.fill(0.005, 0.0));
|
||||
0.005,
|
||||
0.0);
|
||||
private final EncoderSim m_encoderSim = new EncoderSim(m_encoder);
|
||||
private final PWMSim m_motorSim = new PWMSim(m_motor);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.elevatorsimulation.subsystems;
|
||||
|
||||
import edu.wpi.first.math.VecBuilder;
|
||||
import edu.wpi.first.math.controller.ElevatorFeedforward;
|
||||
import edu.wpi.first.math.controller.ProfiledPIDController;
|
||||
import edu.wpi.first.math.system.plant.DCMotor;
|
||||
@@ -55,7 +54,8 @@ public class Elevator implements AutoCloseable {
|
||||
Constants.kMaxElevatorHeightMeters,
|
||||
true,
|
||||
0,
|
||||
VecBuilder.fill(0.01, 0.0));
|
||||
0.01,
|
||||
0.0);
|
||||
private final EncoderSim m_encoderSim = new EncoderSim(m_encoder);
|
||||
private final PWMSim m_motorSim = new PWMSim(m_motor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user