Merge branch 'main' into 2027

This commit is contained in:
Thad House
2024-12-01 12:40:50 -08:00
24 changed files with 168 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ jobs:
include:
- os: ubuntu-22.04
name: Linux
container: wpilib/roborio-cross-ubuntu:2024-22.04
container: wpilib/roborio-cross-ubuntu:2025-22.04
flags: "--preset with-java-and-sccache -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON"
- os: macOS-14
name: macOS

View File

@@ -51,7 +51,7 @@ jobs:
tidy:
name: "clang-tidy"
runs-on: ubuntu-22.04
container: wpilib/roborio-cross-ubuntu:2024-22.04
container: wpilib/roborio-cross-ubuntu:2025-22.04
steps:
- uses: actions/checkout@v4
with:

View File

@@ -30,7 +30,7 @@ jobs:
ctest-flags: ""
name: "${{ matrix.name }}"
runs-on: ubuntu-22.04
container: wpilib/roborio-cross-ubuntu:2024-22.04
container: wpilib/roborio-cross-ubuntu:2025-22.04
steps:
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv4.5-java clang-14 libprotobuf-dev protobuf-compiler ninja-build

View File

@@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2024-22.04
- container: wpilib/roborio-cross-ubuntu:2025-22.04
artifact-name: Athena
build-options: "-Ponlylinuxathena"
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04

View File

@@ -32,7 +32,7 @@ jobs:
- name: Build WPILib with Gradle
uses: addnab/docker-run-action@v3
with:
image: wpilib/roborio-cross-ubuntu:2024-22.04
image: wpilib/roborio-cross-ubuntu:2025-22.04
options: -v ${{ github.workspace }}:/work -w /work -e GITHUB_REF -e CI -e DISPLAY
run: df . && rm -f semicolon_delimited_script && ./gradlew :wpilibc:publish :wpilibj:publish :wpilibNewCommands:publish :hal:publish :cameraserver:publish :ntcore:publish :cscore:publish :wpimath:publish :wpinet:publish :wpiutil:publish :apriltag:publish :wpiunits:publish :simulation:halsim_gui:publish :simulation:halsim_ds_socket:publish :fieldImages:publish :epilogue-processor:publish :epilogue-runtime:publish :thirdparty:googletest:publish -x test -x Javadoc -x doxygen --build-cache && cp -r /root/releases/maven/development /work
- uses: actions/upload-artifact@v4

View File

@@ -55,6 +55,10 @@ public class EpilogueGenerator {
out.println("import static edu.wpi.first.units.Units.Seconds;");
out.println();
out.println("import edu.wpi.first.hal.FRCNetComm;");
out.println("import edu.wpi.first.hal.HAL;");
out.println();
loggerClassNames.stream()
.sorted()
.forEach(
@@ -80,6 +84,18 @@ public class EpilogueGenerator {
out.println();
out.println("public final class Epilogue {");
// Usage reporting
out.println(
"""
static {
HAL.report(
FRCNetComm.tResourceType.kResourceType_LoggingFramework,
FRCNetComm.tInstances.kLoggingFramework_Epilogue
);
}
""");
out.println(
" private static final EpilogueConfiguration config = new EpilogueConfiguration();");
out.println();

View File

@@ -33,9 +33,19 @@ class EpilogueGeneratorTest {
import static edu.wpi.first.units.Units.Seconds;
import edu.wpi.first.hal.FRCNetComm;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.epilogue.ExampleLogger;
public final class Epilogue {
static {
HAL.report(
FRCNetComm.tResourceType.kResourceType_LoggingFramework,
FRCNetComm.tInstances.kLoggingFramework_Epilogue
);
}
private static final EpilogueConfiguration config = new EpilogueConfiguration();
public static final ExampleLogger exampleLogger = new ExampleLogger();
@@ -82,9 +92,19 @@ class EpilogueGeneratorTest {
import static edu.wpi.first.units.Units.Seconds;
import edu.wpi.first.hal.FRCNetComm;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.epilogue.ExampleLogger;
public final class Epilogue {
static {
HAL.report(
FRCNetComm.tResourceType.kResourceType_LoggingFramework,
FRCNetComm.tInstances.kLoggingFramework_Epilogue
);
}
private static final EpilogueConfiguration config = new EpilogueConfiguration();
public static final ExampleLogger exampleLogger = new ExampleLogger();
@@ -126,9 +146,19 @@ class EpilogueGeneratorTest {
import static edu.wpi.first.units.Units.Seconds;
import edu.wpi.first.hal.FRCNetComm;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.epilogue.ExampleLogger;
public final class Epilogue {
static {
HAL.report(
FRCNetComm.tResourceType.kResourceType_LoggingFramework,
FRCNetComm.tInstances.kLoggingFramework_Epilogue
);
}
private static final EpilogueConfiguration config = new EpilogueConfiguration();
public static final ExampleLogger exampleLogger = new ExampleLogger();
@@ -204,10 +234,20 @@ class EpilogueGeneratorTest {
import static edu.wpi.first.units.Units.Seconds;
import edu.wpi.first.hal.FRCNetComm;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.epilogue.AlphaBotLogger;
import edu.wpi.first.epilogue.BetaBotLogger;
public final class Epilogue {
static {
HAL.report(
FRCNetComm.tResourceType.kResourceType_LoggingFramework,
FRCNetComm.tInstances.kLoggingFramework_Epilogue
);
}
private static final EpilogueConfiguration config = new EpilogueConfiguration();
public static final AlphaBotLogger alphaBotLogger = new AlphaBotLogger();
@@ -331,10 +371,20 @@ class EpilogueGeneratorTest {
import static edu.wpi.first.units.Units.Seconds;
import edu.wpi.first.hal.FRCNetComm;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.epilogue.ExampleLogger;
import edu.wpi.first.epilogue.CustomLogger;
public final class Epilogue {
static {
HAL.report(
FRCNetComm.tResourceType.kResourceType_LoggingFramework,
FRCNetComm.tInstances.kLoggingFramework_Epilogue
);
}
private static final EpilogueConfiguration config = new EpilogueConfiguration();
public static final ExampleLogger exampleLogger = new ExampleLogger();

View File

@@ -75,3 +75,6 @@ kLoggingFramework_Epilogue = 2
kLoggingFramework_Monologue = 3
kLoggingFramework_AdvantageKit = 4
kLoggingFramework_DogLog = 5
kPDP_CTRE = 1
kPDP_REV = 2
kPDP_Unknown = 3

View File

@@ -117,3 +117,8 @@ kResourceType_RevSparkFlexPWM = 115
kResourceType_BangBangController = 116
kResourceType_DataLogManager = 117
kResourceType_LoggingFramework = 118
kResourceType_ChoreoTrajectory = 119
kResourceType_ChoreoTrigger = 120
kResourceType_PathWeaverTrajectory = 121
kResourceType_Koors40 = 122
kResourceType_ThriftyNova = 123

View File

@@ -257,6 +257,16 @@ public final class FRCNetComm {
public static final int kResourceType_DataLogManager = 117;
/** kResourceType_LoggingFramework = 118. */
public static final int kResourceType_LoggingFramework = 118;
/** kResourceType_ChoreoTrajectory = 119. */
public static final int kResourceType_ChoreoTrajectory = 119;
/** kResourceType_ChoreoTrigger = 120. */
public static final int kResourceType_ChoreoTrigger = 120;
/** kResourceType_PathWeaverTrajectory = 121. */
public static final int kResourceType_PathWeaverTrajectory = 121;
/** kResourceType_Koors40 = 122. */
public static final int kResourceType_Koors40 = 122;
/** kResourceType_ThriftyNova = 123. */
public static final int kResourceType_ThriftyNova = 123;
}
/**
@@ -421,6 +431,12 @@ public final class FRCNetComm {
public static final int kLoggingFramework_AdvantageKit = 4;
/** kLoggingFramework_DogLog = 5. */
public static final int kLoggingFramework_DogLog = 5;
/** kPDP_CTRE = 1. */
public static final int kPDP_CTRE = 1;
/** kPDP_REV = 2. */
public static final int kPDP_REV = 2;
/** kPDP_Unknown = 3. */
public static final int kPDP_Unknown = 3;
}
/** Utility class. */

View File

@@ -170,6 +170,11 @@ namespace HALUsageReporting {
kResourceType_BangBangController = 116,
kResourceType_DataLogManager = 117,
kResourceType_LoggingFramework = 118,
kResourceType_ChoreoTrajectory = 119,
kResourceType_ChoreoTrigger = 120,
kResourceType_PathWeaverTrajectory = 121,
kResourceType_Koors40 = 122,
kResourceType_ThriftyNova = 123,
};
enum tInstances : int32_t {
kLanguage_LabVIEW = 1,
@@ -249,6 +254,9 @@ namespace HALUsageReporting {
kLoggingFramework_Monologue = 3,
kLoggingFramework_AdvantageKit = 4,
kLoggingFramework_DogLog = 5,
kPDP_CTRE = 1,
kPDP_REV = 2,
kPDP_Unknown = 3,
};
}
#endif

View File

@@ -139,6 +139,11 @@ typedef enum
kResourceType_BangBangController = 116,
kResourceType_DataLogManager = 117,
kResourceType_LoggingFramework = 118,
kResourceType_ChoreoTrajectory = 119,
kResourceType_ChoreoTrigger = 120,
kResourceType_PathWeaverTrajectory = 121,
kResourceType_Koors40 = 122,
kResourceType_ThriftyNova = 123,
// kResourceType_MaximumID = 255,
} tResourceType;
@@ -222,6 +227,9 @@ typedef enum
kLoggingFramework_Monologue = 3,
kLoggingFramework_AdvantageKit = 4,
kLoggingFramework_DogLog = 5,
kPDP_CTRE = 1,
kPDP_REV = 2,
kPDP_Unknown = 3,
} tInstances;
/**

View File

@@ -1,4 +1,4 @@
def opencvVersion = '4.8.0-4'
def opencvVersion = '4.8.0-1'
if (project.hasProperty('useCpp') && project.useCpp) {
model {
@@ -22,12 +22,12 @@ if (project.hasProperty('useCpp') && project.useCpp) {
if (project.hasProperty('useJava') && project.useJava) {
dependencies {
implementation "edu.wpi.first.thirdparty.frc2024.opencv:opencv-java:${opencvVersion}"
implementation "edu.wpi.first.thirdparty.frc2025.opencv:opencv-java:${opencvVersion}"
if (!project.hasProperty('skipDev') || !project.skipDev) {
devImplementation "edu.wpi.first.thirdparty.frc2024.opencv:opencv-java:${opencvVersion}"
devImplementation "edu.wpi.first.thirdparty.frc2025.opencv:opencv-java:${opencvVersion}"
}
if (project.hasProperty('useDocumentation') && project.useDocumentation) {
javaSource "edu.wpi.first.thirdparty.frc2024.opencv:opencv-java:${opencvVersion}:sources"
javaSource "edu.wpi.first.thirdparty.frc2025.opencv:opencv-java:${opencvVersion}:sources"
}
}
}

View File

@@ -1053,6 +1053,7 @@ static void DriverStationExecute() {
}
prevDisableDS = disableDS;
if (disableDS) {
gFMSModel->Update();
return;
}

View File

@@ -39,7 +39,14 @@ PowerDistribution::PowerDistribution() {
m_module = HAL_GetPowerDistributionModuleNumber(m_handle, &status);
FRC_ReportError(status, "Module {}", m_module);
HAL_Report(HALUsageReporting::kResourceType_PDP, m_module + 1);
if (HAL_GetPowerDistributionType(m_handle, &status) ==
HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE) {
HAL_Report(HALUsageReporting::kResourceType_PDP,
HALUsageReporting::kPDP_CTRE);
} else {
HAL_Report(HALUsageReporting::kResourceType_PDP,
HALUsageReporting::kPDP_REV);
}
wpi::SendableRegistry::AddLW(this, "PowerDistribution", m_module);
}
@@ -54,7 +61,13 @@ PowerDistribution::PowerDistribution(int module, ModuleType moduleType) {
m_module = HAL_GetPowerDistributionModuleNumber(m_handle, &status);
FRC_ReportError(status, "Module {}", module);
HAL_Report(HALUsageReporting::kResourceType_PDP, m_module + 1);
if (moduleType == ModuleType::kCTRE) {
HAL_Report(HALUsageReporting::kResourceType_PDP,
HALUsageReporting::kPDP_CTRE);
} else {
HAL_Report(HALUsageReporting::kResourceType_PDP,
HALUsageReporting::kPDP_REV);
}
wpi::SendableRegistry::AddLW(this, "PowerDistribution", m_module);
}

View File

@@ -142,6 +142,10 @@ class WPILibMathShared : public wpi::math::MathShared {
case wpi::math::MathUsageId::kController_BangBangController:
HAL_Report(HALUsageReporting::kResourceType_BangBangController, count);
break;
case wpi::math::MathUsageId::kTrajectory_PathWeaver:
HAL_Report(HALUsageReporting::kResourceType_PathWeaverTrajectory,
count);
break;
}
}

View File

@@ -4,6 +4,7 @@
package edu.wpi.first.wpilibj;
import edu.wpi.first.hal.FRCNetComm.tInstances;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.hal.PowerDistributionFaults;
@@ -51,7 +52,11 @@ public class PowerDistribution implements Sendable, AutoCloseable {
m_handle = PowerDistributionJNI.initialize(module, moduleType.value);
m_module = PowerDistributionJNI.getModuleNumber(m_handle);
HAL.report(tResourceType.kResourceType_PDP, m_module + 1);
if (moduleType == ModuleType.kCTRE) {
HAL.report(tResourceType.kResourceType_PDP, tInstances.kPDP_CTRE);
} else {
HAL.report(tResourceType.kResourceType_PDP, tInstances.kPDP_REV);
}
SendableRegistry.addLW(this, "PowerDistribution", m_module);
}
@@ -65,7 +70,12 @@ public class PowerDistribution implements Sendable, AutoCloseable {
m_handle = PowerDistributionJNI.initialize(kDefaultModule, PowerDistributionJNI.AUTOMATIC_TYPE);
m_module = PowerDistributionJNI.getModuleNumber(m_handle);
HAL.report(tResourceType.kResourceType_PDP, m_module + 1);
if (PowerDistributionJNI.getType(m_handle) == PowerDistributionJNI.CTRE_TYPE) {
HAL.report(tResourceType.kResourceType_PDP, tInstances.kPDP_CTRE);
} else {
HAL.report(tResourceType.kResourceType_PDP, tInstances.kPDP_REV);
}
SendableRegistry.addLW(this, "PowerDistribution", m_module);
}

View File

@@ -117,6 +117,8 @@ public abstract class RobotBase implements AutoCloseable {
tResourceType.kResourceType_ProfiledPIDController, count);
case kController_BangBangController -> HAL.report(
tResourceType.kResourceType_BangBangController, count);
case kTrajectory_PathWeaver -> HAL.report(
tResourceType.kResourceType_PathWeaverTrajectory, count);
default -> {
// NOP
}

View File

@@ -38,4 +38,7 @@ public enum MathUsageId {
/** BangBangController. */
kController_BangBangController,
/** PathWeaver Trajectory. */
kTrajectory_PathWeaver,
}

View File

@@ -4,6 +4,8 @@
package edu.wpi.first.math.trajectory;
import edu.wpi.first.math.MathSharedStore;
import edu.wpi.first.math.MathUsageId;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.jni.TrajectoryUtilJNI;
@@ -68,6 +70,8 @@ public final class TrajectoryUtil {
return elements;
}
private static int pathWeaverTrajectoryInstances;
/**
* Imports a Trajectory from a JSON file exported from PathWeaver.
*
@@ -76,6 +80,8 @@ public final class TrajectoryUtil {
* @throws IOException if reading from the file fails.
*/
public static Trajectory fromPathweaverJson(Path path) throws IOException {
MathSharedStore.reportUsage(
MathUsageId.kTrajectory_PathWeaver, ++pathWeaverTrajectoryInstances);
return createTrajectoryFromElements(TrajectoryUtilJNI.fromPathweaverJson(path.toString()));
}

View File

@@ -36,6 +36,10 @@ Trajectory TrajectoryUtil::FromPathweaverJson(std::string_view path) {
wpi::json json = wpi::json::parse(fileBuffer.value()->GetCharBuffer());
wpi::math::MathSharedStore::ReportUsage(
wpi::math::MathUsageId::kTrajectory_PathWeaver,
++pathWeaverTrajectoryInstances);
return Trajectory{json.get<std::vector<Trajectory::State>>()};
}

View File

@@ -53,5 +53,9 @@ class WPILIB_DLLEXPORT TrajectoryUtil {
* @return the trajectory represented by the JSON
*/
static Trajectory DeserializeTrajectory(std::string_view jsonStr);
private:
// Usage reporting for PathWeaver Trajectory instances
inline static int pathWeaverTrajectoryInstances = 0;
};
} // namespace frc

View File

@@ -25,6 +25,7 @@ enum class MathUsageId {
kController_PIDController2,
kController_ProfiledPIDController,
kController_BangBangController,
kTrajectory_PathWeaver,
};
class WPILIB_DLLEXPORT MathShared {

View File

@@ -113,7 +113,7 @@ concept MutableStructSerializable =
* In addition to meeting StructSerializable, implementations must define a
* wpi::Struct<T> static member
* `void ForEachNested(std::invocable<std::string_view, std::string_view) auto
* fn)` (or equivalent) and call ForEachNestedStruct<Type> on each nested struct
* fn)` (or equivalent) and call ForEachStructSchema<Type> on each nested struct
* type.
*/
template <typename T, typename... I>