Class CascadeAscopeDisplay
java.lang.Object
com.flarerobotics.lib.ascope.linear.CascadeAscopeDisplay
Simulates a cascade elevator and calculates stage positions, publishing them to Network
Tables (via Akit Logger) for visualization in AdvantageScope.
Model: If N stages are present (N >= 1) and the elevator's "raw" height is h, then the i'th stage gets a fraction of h: ((N - i + 1) / N) * h.
-
Constructor Summary
ConstructorsConstructorDescriptionCascadeAscopeDisplay
(String name, int stages, double offsetMeters, Supplier<Double> heightSupplierMeters, double elevatorMaxHeightMeters) Constructs a new CascadeAscopeDisplay with an upright elevator (no tilt).CascadeAscopeDisplay
(String name, int stages, double offsetMeters, Supplier<Double> heightSupplierMeters, Supplier<edu.wpi.first.math.geometry.Rotation3d> angleRadians, double elevatorMaxHeightMeters) Constructs a new CascadeAscopeDisplay. -
Method Summary
Modifier and TypeMethodDescriptionSupplier<edu.wpi.first.math.geometry.Pose3d>
attachMechanism
(Supplier<edu.wpi.first.math.geometry.Transform3d> offset) Attaches a mechanism to the carriage.edu.wpi.first.math.geometry.Pose3d
getStagePose
(int stage) Returns the pose of the specified stage.void
update()
Updates the Network Table outputs.
-
Constructor Details
-
CascadeAscopeDisplay
public CascadeAscopeDisplay(String name, int stages, double offsetMeters, Supplier<Double> heightSupplierMeters, Supplier<edu.wpi.first.math.geometry.Rotation3d> angleRadians, double elevatorMaxHeightMeters) Constructs a new CascadeAscopeDisplay.- Parameters:
name
- The name of the system.stages
- The number of stages in the elevator (>= 1).offsetMeters
- A baseline offset (in meters). Often used if the zero point of the height sensor isn't actually the bottom of the elevator.heightSupplierMeters
- The supplier returning the elevator's current raw height (in meters).angleRadians
- The tilt of the elevator as a Rotation3d (use Rotation3d.kZero for upright).elevatorMaxHeightMeters
- The physical max height (in meters) of the elevator.
-
CascadeAscopeDisplay
public CascadeAscopeDisplay(String name, int stages, double offsetMeters, Supplier<Double> heightSupplierMeters, double elevatorMaxHeightMeters) Constructs a new CascadeAscopeDisplay with an upright elevator (no tilt).- Parameters:
name
- The name of the system.stages
- The number of stages in the elevator (>= 1).offsetMeters
- A baseline offset (in meters). Often used if the zero point of the height sensor isn't actually the bottom of the elevator.heightSupplierMeters
- The supplier returning the elevator's current raw height (in meters).elevatorMaxHeightMeters
- The physical max height (in meters) of the elevator.
-
-
Method Details
-
update
public void update()Updates the Network Table outputs. Data is stored in the path as a Pose3d:Simulation/{SYSTEM_NAME}Elevator/Stage{I}/Pose
-
getStagePose
public edu.wpi.first.math.geometry.Pose3d getStagePose(int stage) Returns the pose of the specified stage.- Parameters:
stage
- The stage number (1 = carriage).- Returns:
- The AdvantageScope zero-position relative pose.
-
attachMechanism
public Supplier<edu.wpi.first.math.geometry.Pose3d> attachMechanism(Supplier<edu.wpi.first.math.geometry.Transform3d> offset) Attaches a mechanism to the carriage.- Parameters:
offset
- The offset from the carriage, uses a supplier because attached mechanisms generally move or rotate. Generally used to supply rotational offsets.- Returns:
- The offset pose supplier from the carriage.
-