Class ContinuousAscopeDisplay
java.lang.Object
com.flarerobotics.lib.ascope.linear.ContinuousAscopeDisplay
Simulates a continuous elevator and calculates stage positions, publishing them to Network
Tables (via Akit Logger) for visualization in AdvantageScope.
First, the carriage moves, but this doesn't affect any other stages. Then, stage 2 raises and moves all the higer stages and the carriage. This goes on for all other stages. And this assumes that the carriage is attached to the last stage of the elevator.
NOTE: The height is based off the carriage.
Automatically accounts for the offset provided.
-
Constructor Summary
ConstructorsConstructorDescriptionContinuousAscopeDisplay
(String name, int totalStages, double maxHeightMeters, double offset, Supplier<Double> heightSupplier, Supplier<edu.wpi.first.math.geometry.Rotation3d> angle) Constructs a new ContinuousAscopeDisplay.ContinuousAscopeDisplay
(String name, int totalStages, double maxHeightMeters, double offset, Supplier<Double> heightSupplier, Supplier<edu.wpi.first.math.geometry.Rotation3d> angle, double[] stageLengths) Constructs a new ContinuousAscopeDisplay. -
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 3D pose of the given stage (1-indexed).void
update()
Updates the Network Table outputs.
-
Constructor Details
-
ContinuousAscopeDisplay
public ContinuousAscopeDisplay(String name, int totalStages, double maxHeightMeters, double offset, Supplier<Double> heightSupplier, Supplier<edu.wpi.first.math.geometry.Rotation3d> angle) Constructs a new ContinuousAscopeDisplay.- Parameters:
name
- The name of the system.totalStages
- The amount of stages present. The first stage is the carriage.maxHeightMeters
- The maximum reachable height, in meters.offset
- The pose offset applied to the supplied pose, in meters. Used when a mechanism pose is provided instead of a carriage pose.heightSupplier
- The elevator height supplier.angle
- The elevator angle supplier.
-
ContinuousAscopeDisplay
public ContinuousAscopeDisplay(String name, int totalStages, double maxHeightMeters, double offset, Supplier<Double> heightSupplier, Supplier<edu.wpi.first.math.geometry.Rotation3d> angle, double[] stageLengths) Constructs a new ContinuousAscopeDisplay.- Parameters:
name
- The name of the system.totalStages
- The amount of stages present. The first stage is the carriage.maxHeightMeters
- The maximum reachable height, in meters.offset
- The pose offset applied to the supplied pose, in meters. Used when a mechanism pose is provided instead of a carriage pose.heightSupplier
- The elevator height supplier.angle
- The elevator angle supplier.stageLengths
- The length of each stage in ascending order, starting from stage 1.
-
-
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 3D pose of the given stage (1-indexed).- Parameters:
stage
- The stage number, 1-indexed.- 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 pose supplier.
-