mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Clean up physics simulation class APIs (#2763)
This commit is contained in:
committed by
GitHub
parent
8f3e5794b3
commit
061432147d
@@ -19,6 +19,7 @@ import edu.wpi.first.wpilibj.simulation.BatterySim;
|
||||
import edu.wpi.first.wpilibj.simulation.SingleJointedArmSim;
|
||||
import edu.wpi.first.wpilibj.system.plant.DCMotor;
|
||||
import edu.wpi.first.wpilibj.util.Units;
|
||||
import edu.wpi.first.wpiutil.math.VecBuilder;
|
||||
|
||||
/**
|
||||
* This is a sample program to demonstrate the use of elevator simulation with existing code.
|
||||
@@ -53,11 +54,13 @@ public class Robot extends TimedRobot {
|
||||
// to 0 degrees (rotated straight forwards).
|
||||
private final SingleJointedArmSim m_armSim = new SingleJointedArmSim(m_armGearbox,
|
||||
m_armReduction,
|
||||
m_armMass,
|
||||
SingleJointedArmSim.estimateMOI(m_armLength, m_armMass),
|
||||
m_armLength,
|
||||
Units.degreesToRadians(-180),
|
||||
Units.degreesToRadians(0),
|
||||
Units.degreesToRadians(0.5) // Add noise with a standard deviation of 0.5 degrees
|
||||
m_armMass,
|
||||
true,
|
||||
VecBuilder.fill(Units.degreesToRadians(0.5)) // Add noise with a std-dev of 0.5 degrees
|
||||
);
|
||||
private final EncoderSim m_encoderSim = new EncoderSim(m_encoder);
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ public class Robot extends TimedRobot {
|
||||
|
||||
// Simulation classes help us simulate what's going on, including gravity.
|
||||
private final ElevatorSim m_elevatorSim = new ElevatorSim(m_elevatorGearbox,
|
||||
kElevatorGearing,
|
||||
kCarriageMass,
|
||||
kElevatorDrumRadius,
|
||||
kElevatorGearing,
|
||||
kMinElevatorHeight,
|
||||
kMaxElevatorHeight,
|
||||
VecBuilder.fill(0.01));
|
||||
|
||||
Reference in New Issue
Block a user