[copybara] mostrobotpy to allwpilib (#8503)

Resync with `mostrobotpy`

This mostly involves the big "ignore almost everything in the HAL
project" and some fixups for the Addressable LED classes.

Required two small hand fixes to get it building over here with bazel,
and with more compiler warnings on.

I also manually zeroed out the `repo_url` field in the toml files to
avoid unnecessary churn whenever it goes from a release build to a
development build. I already did this with `version` field in there, and
will do a follow up PR that updates the copybara script to do it
automatically.

---------

Co-authored-by: Default email <default@default.com>
This commit is contained in:
PJ Reiniger
2025-12-31 12:06:01 -05:00
committed by GitHub
parent bdc9391738
commit 40fb9ff562
233 changed files with 1796 additions and 4455 deletions

View File

@@ -31,7 +31,7 @@ packages = ["src/native"]
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "wpilibc-cpp"
group_id = "org.wpilib.wpilibc"
repo_url = "https://frcmaven.wpi.edu/artifactory/release-2027"
repo_url = ""
version = "0.0.0"
extract_to = "src/native/wpilib"

View File

@@ -50,10 +50,6 @@ packages = ["wpilib"]
[tool.semiwrap]
update_init = [
"wpilib",
"wpilib.counter",
"wpilib.drive",
"wpilib.event",
"wpilib.interfaces wpilib._wpilib.interfaces",
"wpilib.simulation",
"wpilib.sysid wpilib._wpilib.sysid",
]
@@ -78,9 +74,7 @@ scan_headers_ignore = [
name = "wpilib"
wraps = ["robotpy-native-wpilib"]
depends = [
"wpihal", "wpiutil", "ntcore",
"wpimath", "wpimath_geometry", "wpimath_controls",
"wpilib_event"
"wpihal", "wpiutil", "ntcore", "wpimath"
]
includes = ["wpilib/src"]
@@ -93,6 +87,16 @@ Filesystem = "rpy/Filesystem.h"
MotorControllerGroup = "rpy/MotorControllerGroup.h"
Notifier = "rpy/Notifier.h"
# wpi/counter
EdgeConfiguration = "wpi/counter/EdgeConfiguration.hpp"
Tachometer = "wpi/counter/Tachometer.hpp"
UpDownCounter = "wpi/counter/UpDownCounter.hpp"
# wpi/drive
DifferentialDrive = "wpi/drive/DifferentialDrive.hpp"
MecanumDrive = "wpi/drive/MecanumDrive.hpp"
RobotDriveBase = "wpi/drive/RobotDriveBase.hpp"
# wpi/driverstation
DriverStation = "wpi/driverstation/DriverStation.hpp"
Gamepad = "wpi/driverstation/Gamepad.hpp"
@@ -103,6 +107,11 @@ PS5Controller = "wpi/driverstation/PS5Controller.hpp"
StadiaController = "wpi/driverstation/StadiaController.hpp"
XboxController = "wpi/driverstation/XboxController.hpp"
# wpi/event
BooleanEvent = "wpi/event/BooleanEvent.hpp"
EventLoop = "wpi/event/EventLoop.hpp"
NetworkBooleanEvent = "wpi/event/NetworkBooleanEvent.hpp"
# wpi/framework
IterativeRobotBase = "wpi/framework/IterativeRobotBase.hpp"
OpModeRobot = "wpi/framework/OpModeRobot.hpp"
@@ -218,50 +227,10 @@ Preferences = "wpi/util/Preferences.hpp"
SensorUtil = "wpi/util/SensorUtil.hpp"
[tool.semiwrap.extension_modules."wpilib.counter._counter"]
name = "wpilib_counter"
wraps = ["robotpy-native-wpilib"]
depends = ["wpilib"]
yaml_path = "semiwrap/counter"
[tool.semiwrap.extension_modules."wpilib.counter._counter".headers]
# wpi/counter
EdgeConfiguration = "wpi/counter/EdgeConfiguration.hpp"
Tachometer = "wpi/counter/Tachometer.hpp"
UpDownCounter = "wpi/counter/UpDownCounter.hpp"
[tool.semiwrap.extension_modules."wpilib.drive._drive"]
name = "wpilib_drive"
wraps = ["robotpy-native-wpilib"]
depends = ["wpilib"]
yaml_path = "semiwrap/drive"
[tool.semiwrap.extension_modules."wpilib.drive._drive".headers]
# wpi/drive
DifferentialDrive = "wpi/drive/DifferentialDrive.hpp"
MecanumDrive = "wpi/drive/MecanumDrive.hpp"
RobotDriveBase = "wpi/drive/RobotDriveBase.hpp"
[tool.semiwrap.extension_modules."wpilib.event._event"]
name = "wpilib_event"
wraps = ["robotpy-native-wpilib"]
# depends = ["wpilib", "wpimath_filter"]
depends = ["wpimath_filter"]
yaml_path = "semiwrap/event"
[tool.semiwrap.extension_modules."wpilib.event._event".headers]
# wpi/event
BooleanEvent = "wpi/event/BooleanEvent.hpp"
EventLoop = "wpi/event/EventLoop.hpp"
NetworkBooleanEvent = "wpi/event/NetworkBooleanEvent.hpp"
[tool.semiwrap.extension_modules."wpilib.simulation._simulation"]
name = "wpilib_simulation"
wraps = ["robotpy-native-wpilib"]
depends = ["wpilib", "wpimath_controls", "wpimath_geometry", "wpimath_kinematics"]
depends = ["wpilib", "wpimath"]
yaml_path = "semiwrap/simulation"
[tool.semiwrap.extension_modules."wpilib.simulation._simulation".headers]

View File

@@ -21,8 +21,8 @@ classes:
ColorOrder:
wpi::AddressableLED::LEDData:
force_no_trampoline: true
base_qualnames:
HAL_AddressableLEDData: ::HAL_AddressableLEDData
ignored_bases:
- HAL_AddressableLEDData
methods:
LEDData:
overloads:
@@ -41,4 +41,11 @@ classes:
overloads:
const wpi::util::Color&:
const wpi::util::Color8Bit&:
inline_code: |
.def_readwrite("r", &wpi::AddressableLED::LEDData::r)
.def_readwrite("g", &wpi::AddressableLED::LEDData::g)
.def_readwrite("b", &wpi::AddressableLED::LEDData::b)
.def("__eq__", [](wpi::AddressableLED::LEDData &self, wpi::AddressableLED::LEDData &other) {
return self.r == other.r && self.g == other.g && self.b == other.b;
})
;

View File

@@ -1,6 +1,3 @@
defaults:
subpackage: interfaces
classes:
wpi::CounterBase:
enums:

View File

@@ -1,6 +1,3 @@
defaults:
subpackage: interfaces
extra_includes:
- wpi/driverstation/DriverStation.hpp
- wpi/event/BooleanEvent.hpp

View File

@@ -1,6 +1,3 @@
defaults:
subpackage: interfaces
classes:
wpi::MotorController:
methods:

View File

@@ -5,6 +5,8 @@ classes:
wpi::sim::AddressableLEDSim:
force_type_casters:
- std::function
- std::span
- std::vector
methods:
AddressableLEDSim:
overloads:
@@ -18,9 +20,32 @@ classes:
SetLength:
RegisterDataCallback:
GetData:
param_override:
data:
ignore: true
cpp_code: |
[](wpi::sim::AddressableLEDSim &self) {
int len = self.GetData(nullptr);
std::vector<wpi::AddressableLED::LEDData> data(len);
self.GetData(data.data());
return data;
}
SetData:
param_override:
length:
ignore: true
cpp_code: |
[](wpi::sim::AddressableLEDSim &self, std::span<wpi::AddressableLED::LEDData> &data) {
if (static_cast<int>(data.size()) != self.GetLength()) {
std::string msg = fmt::format("data must have length {} (got {})", self.GetLength(), data.size());
throw py::value_error(msg);
}
self.SetData(data.data());
}
RegisterStartCallback:
GetStart:
SetStart:
GetGlobalData:
ignore: true
SetGlobalData:
ignore: true

View File

@@ -1,8 +1,5 @@
from . import _init__wpilib
# TODO: robotpy-build subpackage bug
from wpimath._controls._controls import trajectory as _
# autogenerated by 'semiwrap create-imports wpilib wpilib._wpilib'
from ._wpilib import (
ADXL345_I2C,
@@ -12,18 +9,23 @@ from ._wpilib import (
AnalogEncoder,
AnalogInput,
AnalogPotentiometer,
BooleanEvent,
CAN,
CANStatus,
Compressor,
CompressorConfigType,
CounterBase,
DataLogManager,
DifferentialDrive,
DigitalInput,
DigitalOutput,
DoubleSolenoid,
DriverStation,
DutyCycle,
DutyCycleEncoder,
EdgeConfiguration,
Encoder,
EventLoop,
ExpansionHub,
ExpansionHubMotor,
ExpansionHubPidConstants,
@@ -31,18 +33,22 @@ from ._wpilib import (
Field2d,
FieldObject2d,
Gamepad,
GenericHID,
I2C,
IterativeRobotBase,
Joystick,
Koors40,
LEDPattern,
LinearOpMode,
MecanumDrive,
Mechanism2d,
MechanismLigament2d,
MechanismObject2d,
MechanismRoot2d,
MotorController,
MotorControllerGroup,
MotorSafety,
NetworkBooleanEvent,
Notifier,
OnboardIMU,
OpMode,
@@ -66,6 +72,7 @@ from ._wpilib import (
Preferences,
RobotBase,
RobotController,
RobotDriveBase,
RuntimeType,
SendableBuilderImpl,
SendableChooser,
@@ -79,11 +86,13 @@ from ._wpilib import (
SparkMini,
StadiaController,
SystemServer,
Tachometer,
Talon,
TimedRobot,
Timer,
TimesliceRobot,
Tracer,
UpDownCounter,
VictorSP,
Watchdog,
XboxController,
@@ -104,18 +113,23 @@ __all__ = [
"AnalogEncoder",
"AnalogInput",
"AnalogPotentiometer",
"BooleanEvent",
"CAN",
"CANStatus",
"Compressor",
"CompressorConfigType",
"CounterBase",
"DataLogManager",
"DifferentialDrive",
"DigitalInput",
"DigitalOutput",
"DoubleSolenoid",
"DriverStation",
"DutyCycle",
"DutyCycleEncoder",
"EdgeConfiguration",
"Encoder",
"EventLoop",
"ExpansionHub",
"ExpansionHubMotor",
"ExpansionHubPidConstants",
@@ -123,18 +137,22 @@ __all__ = [
"Field2d",
"FieldObject2d",
"Gamepad",
"GenericHID",
"I2C",
"IterativeRobotBase",
"Joystick",
"Koors40",
"LEDPattern",
"LinearOpMode",
"MecanumDrive",
"Mechanism2d",
"MechanismLigament2d",
"MechanismObject2d",
"MechanismRoot2d",
"MotorController",
"MotorControllerGroup",
"MotorSafety",
"NetworkBooleanEvent",
"Notifier",
"OnboardIMU",
"OpMode",
@@ -158,6 +176,7 @@ __all__ = [
"Preferences",
"RobotBase",
"RobotController",
"RobotDriveBase",
"RuntimeType",
"SendableBuilderImpl",
"SendableChooser",
@@ -171,11 +190,13 @@ __all__ = [
"SparkMini",
"StadiaController",
"SystemServer",
"Tachometer",
"Talon",
"TimedRobot",
"Timer",
"TimesliceRobot",
"Tracer",
"UpDownCounter",
"VictorSP",
"Watchdog",
"XboxController",

View File

@@ -1,6 +0,0 @@
from . import _init__counter
# autogenerated by 'semiwrap create-imports wpilib.counter wpilib.counter._counter'
from ._counter import EdgeConfiguration, Tachometer, UpDownCounter
__all__ = ["EdgeConfiguration", "Tachometer", "UpDownCounter"]

View File

@@ -1,7 +0,0 @@
#include "semiwrap_init.wpilib.counter._counter.hpp"
SEMIWRAP_PYBIND11_MODULE(m)
{
initWrapper(m);
}

View File

@@ -1,8 +0,0 @@
from . import _init__drive
# autogenerated by 'semiwrap create-imports wpilib.drive wpilib.drive._drive'
from ._drive import DifferentialDrive, MecanumDrive, RobotDriveBase
__all__ = ["DifferentialDrive", "MecanumDrive", "RobotDriveBase"]
del _init__drive

View File

@@ -1,7 +0,0 @@
#include "semiwrap_init.wpilib.drive._drive.hpp"
SEMIWRAP_PYBIND11_MODULE(m)
{
initWrapper(m);
}

View File

@@ -1,6 +0,0 @@
from . import _init__event
# autogenerated by 'semiwrap create-imports wpilib.event wpilib.event._event'
from ._event import BooleanEvent, EventLoop, NetworkBooleanEvent
__all__ = ["BooleanEvent", "EventLoop", "NetworkBooleanEvent"]

View File

@@ -1,7 +0,0 @@
#include "semiwrap_init.wpilib.event._event.hpp"
SEMIWRAP_PYBIND11_MODULE(m)
{
initWrapper(m);
}

View File

@@ -1,4 +0,0 @@
# autogenerated by 'semiwrap create-imports wpilib.interfaces wpilib._wpilib.interfaces'
from .._wpilib.interfaces import CounterBase, GenericHID, MotorController
__all__ = ["CounterBase", "GenericHID", "MotorController"]

View File

@@ -1,8 +1,5 @@
from . import _init__simulation
# needed for dcmotor return value, TODO fix in robotpy-build
from wpimath._controls._controls import plant as _
# autogenerated by 'semiwrap create-imports wpilib.simulation wpilib.simulation._simulation'
from ._simulation import (
ADXL345Sim,