v4.1.0
v4.1.0 (2024-09-16)
New features and additions for INTO THE DEEP.
Critical bug fixes
- The
FieldTiles
(FieldTile
) custom WPIUnits unit has been updated from being defined as 23.6 inches to 24 inches- This change may potentially break previous implementations that relied on the nature of
FieldTile
being 23.6 inches - This unit was supposed to have a magnitude of 24, where the approximation was used by mistake
- This change may potentially break previous implementations that relied on the nature of
TaskGroup
timeout calculation has been fixed- Previously, task group timeout calculations were done all via the parallel calculation, which takes the highest value and sets it to the group timeout
- However, this was short-sighted as other task groups like the sequential task group instead operate on a sum-of-all-timeouts
- These incorrectly implemented timeouts have been fixed appropriately for all task groups, via a new super argument for the
TaskGroup
abstraction
Scheduler
runOnce()
now behaves uniformly between subsystems and independent tasks- Before,
runOnce()
would queue once on a subsystem, and execute once independently - This made inconsistent behaviour between the two due to an internal flaw in the
Scheduler
- Now,
runOnce()
will guarantee one queue of a task from start to finish regardless of environment, putting emphasis onfinishingIf()
to end queued execution
- Before,
Exceptions
no longer swallows theForceStopException
(oops)
Non-breaking changes
AprilTagPoseEstimator
now internally uses Kalman filters to fuse odometry and AprilTag readings- The Kalman gains are set to sane defaults and can be customised via
setKalmanGains
- Note!
setHeadingEstimate
now defaults to true, as the Kalman filter should now filter out the erratic heading readings
- The Kalman gains are set to sane defaults and can be customised via
BunyipsComponent
and their derivatives (e.g.BunyipsSubsystem
,Task
) can now be constructed in the OpMode member fields- A constructor hook now supplies a partially constructed static reference to a BunyipsOpMode to allow instance calls to be made in the member fields
- This partially constructed static instance is reassigned as usual at runtime to preserve normal behaviour
- The
toShortString()
(toString()
) method attached to WPIUnits has been updated- Previously
Unit
instances that calledtoString()
would provide the string with 3 decimal point scientific notation - This has been changed to simply show the magnitude in full for brevity
- Instead of returning
1.234e+04 V/m
, this method will now return1234 V/m
- This combines
toLongString()
without the full unit name - Previous scientific notation behaviour has been preserved in a new
toScientificString()
method
- Previously
BunyipsOpMode
now exposes the previously protected methodsonActiveLoop
andsetInitTask
as public to allow static access- This allows you to add
activeLoop
snippets from anywhere, including theRobotConfig
- This allows you to add
toString()
ofStartingPositions
instances now internally callStartingPositions.getHTMLIfAvailable()
to return an HTML-receiver-friendly output without having to callgetHTMLIfAvailable()
manually- The built-in
name()
method preserves the old behaviour oftoString()
- The built-in
- FtcDashboard now shows more overlay data for certain
AlignTo
tasks, including vector powers for drive input - Various JavaDoc and debugging statement updates
OnceTask
internal timeout has been increased to 10ms to allow interpretation of summed timeouts to work properlyBunyipsOpMode
onActiveLoop
now runs all Runnables through theExceptions
handler to ensure exceptions do not hamper the rest of the loop- Various uses of
PIDFController
in constructors have been replaced with the more relaxedPIDF
interface to allow for a wider range of controllers- Note that since the coefficients are no longer constant, dynamically adjustable coefficients that were on the task/class level only apply to the underlying PIDF coefficients as they did previously
- Other dynamically adjusted coefficients will need to be managed by yourself
BlinkinLights
now has methods for setting the default pattern to other patterns if desired, it is no longer final- To follow subsystem convention,
BlinkinLights
methods now return their instance for builder-like patterns
- To follow subsystem convention,
Task.reset()
now no-ops if the task has already been reset, preventing the multi-fire ofonReset()
BunyipsOpMode
will now try to reset the RC lights viaexit()
if it can, since it still has access to hardware writesTelemetryMenu
now spaces options slightly more to allow FtcDashboard users to read the menu easier
Bug fixes
- Hardcoded values of
org.murraybridgebunyips.bunyipslib
have been replaced with theBuildConfig.LIBRARY_PACKAGE_NAME
constant for cleanliness - Modern uses of out-of-range exceptions thrown in BunyipsLib now respect the domain of the bound
- Future bounds-checking now uses Apache Math3 utilities, old checks will be left as-is
- Debugging statement for the
onReady()
call inAutonomousBunyipsOpMode
now strips HTML from the selected OpMode setDefaultTask
ofBunyipsSubsystem
now internally callsonSubsystem(this)
to ensure default tasks are assigned to the current subsystem- The
PIDF
interface now extendsSystemController
as they are always used together BunyipsOpMode
no longer initially sleeps before evaluating the init-loop for the first time- Exceptions thrown via
Exceptions
during init will now be recognised and alerted in theBunyipsOpMode
init-cycle DualTelemetry.addData
now accepts nullable data parameters to match other instances of adding telemetry data- Fix a missing return from an early return in
UserSelection
Additions
- New
StartingConfiguration
system to assist in robot starting configuration selection- This class has been designed to expand the
StartingPositions
enum following the 2024 season not being limited to simply two tiles per alliance - Instances of a
StartingConfiguration.Position
indicate the exact orientation/rotation/alliance/origin that the programmer has desired, rather than simply being on an alliance and left/right side - Construction of a starting position is done through a builder pattern (e.g.
blueRight().tile(4)
) with options for translation offset and rotation - These new configurations are designed to be used seamlessly with an
AutonomousBunyipsOpMode
through thesetOpModes()
method- The programmer now has a lot more information regarding the starting configuration of the robot, including a
toFieldPose()
method to extract the starting configuration in terms of the FTC Field Coordinate system
- The programmer now has a lot more information regarding the starting configuration of the robot, including a
- Position
toString()
method will return a HTML human-friendly output (forUserSelection
)Red Alliance, Right
from StartingPositions becomesOn Red, Tile #3 from RIGHT wall
in a StartingConfiguration
- Documentation and conversion methods have been added to both StartingPositions and the new class
- StartingPositions is not planned to be deprecated to preserve backward compatibility
- See the corresponding JavaDoc for more information
- This class has been designed to expand the
- New
Filter
class, which provides data and sensor filters- The newly added filters available through this class are a
LowPass
filter, 1DKalman
filter, andWeightedFusion
filter - The
Kalman
filter is used internally in theAprilTagPoseEstimator
- The newly added filters available through this class are a
- New
AlignToPointDriveTask
, which uses a PID controller and feedforward to rotate to a field point as a TeleOp drive task - New
DebugMode
, which is a Runnable built via a builder pattern to auto-halt or terminate OpModes based on various conditions- This includes watchdog timeouts, gamepad kill switches, and IMU roll detection
- These features were designed for use in a debugging environment to quickly stop the robot if working with experimental code
Motor
now has configuration options for setting a power cache tolerance and power refresh rate- These utilities allow hardware writes to be optimised, but must be used with caution
- See
setPowerDeltaThreshold
andsetPowerRefreshRate
ofMotor
AprilTagData
is now populated with a new fieldrobotPose
which is new from SDK 10.0- This pose is returned directly from the processor and is calculated via the camera-robot pose provided in the
AprilTag
builder
- This pose is returned directly from the processor and is calculated via the camera-robot pose provided in the
- All
RoadRunnerDrive
instances now must include asetRotationPriorityWeightedDrivePower()
override to run the weighted drive power calculation with rotational priority- Custom implementations of
RoadRunnerDrive
will need to extend this new method and implement it accordingly CartesianMecanumDrive
now exposes an internal static method to calculate rotation priority Mecanum poses
- Custom implementations of
IMUEx
now has asetYawMultiplier()
method, which can be used to set a multiplicative scale for IMU yaw readings- This is similar to the X and Y multipliers attached to tracking wheel localizers
BunyipsOpMode
now has astopMotors()
method which serves as a softer alternative tosafeHaltHardware()
Exceptions
now stores a static list of all exceptions that have been thrown- The reset method for this instance has been appended to
Storage.resetAllStaticFieldsForOpMode()
- The reset method for this instance has been appended to
BunyipsOpMode
now has a static methodifRunning()
which will execute the suppliedConsumer<BunyipsOpMode>
ifBunyipsOpMode.isRunning()
is trueBunyipsOpMode
now has agetInitTask()
method to return anOptional<Runnable>
of the currently respected init-taskText.removeHtml()
created to regex out HTML tags and non-breaking spaces from stringsText.upper()
and.lower()
created for cross-compatibility reasons in Kotlin, which will uppercase and lowercase strings