Merge branch 'main' into 2027

This commit is contained in:
Peter Johnson
2026-02-15 00:51:21 -08:00
98 changed files with 3031 additions and 219 deletions

View File

@@ -1733,8 +1733,7 @@ public final class DriverStation {
*
* <p>When the DS is in practice mode, this number is a floating point number, and counts down.
*
* <p>When the DS is in teleop or autonomous mode, this number is a floating point number, and
* counts up.
* <p>When the DS is in teleop or autonomous mode, this number returns -1.0.
*
* <p>Simulation matches DS behavior without an FMS connected.
*

View File

@@ -181,9 +181,9 @@ public class TimedRobot extends IterativeRobotBase {
}
/**
* Return the system clock time in micrseconds for the start of the current periodic loop. This is
* in the same time base as Timer.getFPGATimestamp(), but is stable through a loop. It is updated
* at the beginning of every periodic callback (including the normal periodic loop).
* Return the system clock time in microseconds for the start of the current periodic loop. This
* is in the same time base as Timer.getFPGATimestamp(), but is stable through a loop. It is
* updated at the beginning of every periodic callback (including the normal periodic loop).
*
* @return Robot running time in microseconds, as of the start of the current periodic function.
*/

View File

@@ -14,6 +14,7 @@ import java.util.Objects;
import java.util.function.BooleanSupplier;
import java.util.function.DoubleSupplier;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.hardware.hal.HAL;
import org.wpilib.system.RobotController;
import org.wpilib.units.collections.LongToObjectHashMap;
import org.wpilib.units.measure.Dimensionless;
@@ -150,6 +151,7 @@ public interface LEDPattern {
* @return the mapped pattern
*/
default LEDPattern mapIndex(IndexMapper indexMapper) {
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
int bufLen = reader.getLength();
applyTo(
@@ -295,6 +297,7 @@ public interface LEDPattern {
final long totalTimeMicros = (long) (onTime.in(Microseconds) + offTime.in(Microseconds));
final long onTimeMicros = (long) onTime.in(Microseconds);
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
if (RobotController.getTime() % totalTimeMicros < onTimeMicros) {
applyTo(reader, writer);
@@ -324,6 +327,7 @@ public interface LEDPattern {
* @return the blinking pattern
*/
default LEDPattern synchronizedBlink(BooleanSupplier signal) {
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
if (signal.getAsBoolean()) {
applyTo(reader, writer);
@@ -343,6 +347,7 @@ public interface LEDPattern {
default LEDPattern breathe(Time period) {
final long periodMicros = (long) period.in(Microseconds);
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
applyTo(
reader,
@@ -374,6 +379,7 @@ public interface LEDPattern {
* @return the combined overlay pattern
*/
default LEDPattern overlayOn(LEDPattern base) {
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
// write the base pattern down first...
base.applyTo(reader, writer);
@@ -401,6 +407,7 @@ public interface LEDPattern {
* @return the blended pattern
*/
default LEDPattern blend(LEDPattern other) {
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
applyTo(reader, writer);
@@ -432,6 +439,7 @@ public interface LEDPattern {
* @return the masked pattern
*/
default LEDPattern mask(LEDPattern mask) {
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
// Apply the current pattern down as normal...
applyTo(reader, writer);
@@ -471,6 +479,7 @@ public interface LEDPattern {
default LEDPattern atBrightness(Dimensionless relativeBrightness) {
double multiplier = relativeBrightness.in(Value);
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
applyTo(
reader,
@@ -497,6 +506,7 @@ public interface LEDPattern {
* @return the pattern
*/
static LEDPattern solid(Color color) {
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
int bufLen = reader.getLength();
for (int led = 0; led < bufLen; led++) {
@@ -526,6 +536,7 @@ public interface LEDPattern {
* @return the mask pattern
*/
static LEDPattern progressMaskLayer(DoubleSupplier progressSupplier) {
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
double progress = Math.clamp(progressSupplier.getAsDouble(), 0, 1);
@@ -562,6 +573,7 @@ public interface LEDPattern {
* @return a motionless step pattern
*/
static LEDPattern steps(Map<? extends Number, Color> steps) {
HAL.reportUsage("LEDPattern", "");
if (steps.isEmpty()) {
// no colors specified
DriverStation.reportWarning("Creating LED steps with no colors!", false);
@@ -623,6 +635,7 @@ public interface LEDPattern {
* @return a motionless gradient pattern
*/
static LEDPattern gradient(GradientType type, Color... colors) {
HAL.reportUsage("LEDPattern", "");
if (colors.length == 0) {
// Nothing to display
DriverStation.reportWarning("Creating a gradient with no colors!", false);
@@ -680,6 +693,7 @@ public interface LEDPattern {
* @return the rainbow pattern
*/
static LEDPattern rainbow(int saturation, int value) {
HAL.reportUsage("LEDPattern", "");
return (reader, writer) -> {
int bufLen = reader.getLength();
for (int i = 0; i < bufLen; i++) {

View File

@@ -41,8 +41,16 @@ public class Timer {
* Return the approximate match time. The FMS does not send an official match time to the robots,
* but does send an approximate match time. The value will count down the time remaining in the
* current period (auto or teleop). Warning: This is not an official time (so it cannot be used to
* dispute ref calls or guarantee that a function will trigger before the match ends) The Practice
* Match function of the DS approximates the behavior seen on the field.
* dispute ref calls or guarantee that a function will trigger before the match ends).
*
* <p>When connected to the real field, this number only changes in full integer increments, and
* always counts down.
*
* <p>When the DS is in practice mode, this number is a floating point number, and counts down.
*
* <p>When the DS is in teleop or autonomous mode, this number returns -1.0.
*
* <p>Simulation matches DS behavior without an FMS connected.
*
* @return Time remaining in current match period (auto or teleop) in seconds
*/