From ebe80f9ce58d8ab9ef80a22242c1dac1dc408704 Mon Sep 17 00:00:00 2001 From: David Vo Date: Sat, 2 Aug 2025 16:22:59 +1000 Subject: [PATCH 1/2] Fix CameraServer on SystemCore --- subprojects/robotpy-cscore/cscore/__main__.py | 15 ++------------- subprojects/robotpy-cscore/cscore/src/main.cpp | 12 +----------- subprojects/robotpy-wpilib/wpilib/cameraserver.py | 4 ++-- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/subprojects/robotpy-cscore/cscore/__main__.py b/subprojects/robotpy-cscore/cscore/__main__.py index 51be70c68..5b8ae583a 100644 --- a/subprojects/robotpy-cscore/cscore/__main__.py +++ b/subprojects/robotpy-cscore/cscore/__main__.py @@ -84,7 +84,7 @@ def main(): ) parser.add_argument( "--nt-protocol", - choices=[3, 4], + choices=[4], type=int, help="NetworkTables protocol", default=4, @@ -118,10 +118,7 @@ def main(): else: ntinst.setServer(args.robot) - if args.nt_protocol == 3: - ntinst.startClient3(args.nt_identity) - else: - ntinst.startClient4(args.nt_identity) + ntinst.startClient(args.nt_identity) # If stdin is a pipe, then die when the pipe goes away # -> this allows us to detect if a parent process exits @@ -159,12 +156,4 @@ def main(): if __name__ == "__main__": - # Setup wpi::now on roborio when executed as __main__ - try: - from ._cscore import _setupWpiNow # type: ignore - - _setupWpiNow() - except ImportError: - pass - main() diff --git a/subprojects/robotpy-cscore/cscore/src/main.cpp b/subprojects/robotpy-cscore/cscore/src/main.cpp index 03ea99871..2255306b0 100644 --- a/subprojects/robotpy-cscore/cscore/src/main.cpp +++ b/subprojects/robotpy-cscore/cscore/src/main.cpp @@ -3,12 +3,6 @@ #include "cscore_cpp.h" -#ifdef __FRC_SYSTEMCORE__ -extern "C" { - void WPI_Impl_SetupNowUseDefaultOnRio(void); -} -#endif - SEMIWRAP_PYBIND11_MODULE(m) { initWrapper(m); @@ -22,8 +16,4 @@ SEMIWRAP_PYBIND11_MODULE(m) { CS_Shutdown(); }); m.add_object("_cleanup", cleanup); - - #ifdef __FRC_SYSTEMCORE__ - m.def("_setupWpiNow", WPI_Impl_SetupNowUseDefaultOnRio); - #endif -} \ No newline at end of file +} diff --git a/subprojects/robotpy-wpilib/wpilib/cameraserver.py b/subprojects/robotpy-wpilib/wpilib/cameraserver.py index fdbea9453..397e3a9ad 100644 --- a/subprojects/robotpy-wpilib/wpilib/cameraserver.py +++ b/subprojects/robotpy-wpilib/wpilib/cameraserver.py @@ -72,12 +72,12 @@ def launch(cls, vision_py: Optional[str] = None) -> None: # who do not. cscore handle values indicate type with bits 24-30 if vision_py: + hal.reportUsage("RobotPy/CameraServer", vision_py) if not vision_py.startswith("/"): vision_py = "/home/systemcore/py/" + vision_py args.append(vision_py) - hal.report(hal.tResourceType.kResourceType_PCVideoServer, 0x51) else: - hal.report(hal.tResourceType.kResourceType_PCVideoServer, 0x52) + hal.reportUsage("RobotPy/CameraServer", "") # We open a pipe to it so that when this process exits, it dies proc = subprocess.Popen( From 1084b1313e9f795e71a7cbe1ed0413f9a502ecdb Mon Sep 17 00:00:00 2001 From: David Vo Date: Sat, 2 Aug 2025 16:33:26 +1000 Subject: [PATCH 2/2] cscore: Remove --nt-protocol option --- subprojects/robotpy-cscore/cscore/__main__.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/subprojects/robotpy-cscore/cscore/__main__.py b/subprojects/robotpy-cscore/cscore/__main__.py index 5b8ae583a..61198e464 100644 --- a/subprojects/robotpy-cscore/cscore/__main__.py +++ b/subprojects/robotpy-cscore/cscore/__main__.py @@ -82,13 +82,6 @@ def main(): nt_server_group.add_argument( "--team", help="Team number to specify robot", type=int ) - parser.add_argument( - "--nt-protocol", - choices=[4], - type=int, - help="NetworkTables protocol", - default=4, - ) parser.add_argument( "--nt-identity", default="cscore", help="NetworkTables identity" )