[copybara] mostrobotpy to allwpilib (#8545)

Project import generated by Copybara.
GitOrigin-RevId: f10284b37498bb6a088891ca41f160793ec7fd90
This commit is contained in:
PJ Reiniger
2026-01-12 22:11:02 -05:00
committed by GitHub
parent 7e1260b003
commit 762d1e8b93
64 changed files with 2665 additions and 66 deletions

View File

@@ -0,0 +1,18 @@
robotpy-halsim-ds-socket
==================
Installing this package will allow you to utilize the 2020+ WPILib GUI
DS Socket from a RobotPy program.
Usage
-----
First, install pyfrc. Then run your robot with the 'sim' argument and --ds-socket flag:
# Windows
py -3 -m robotpy sim --ds-socket
# Linux/OSX
python3 -m robotpy sim --ds-socket
WPILib's documentation for using the simulator can be found at http://docs.wpilib.org/en/latest/docs/software/wpilib-tools/robot-simulation/

View File

@@ -0,0 +1 @@
from .main import loadExtension

View File

@@ -0,0 +1,23 @@
import logging
import os
from os.path import abspath, dirname, join
logger = logging.getLogger("halsim_ds_socket")
def loadExtension():
try:
import hal
except ImportError as e:
# really, should never happen...
raise ImportError("you must install robotpy-hal!") from e
from .version import version
logger.info("WPILib HAL Simulation DS Socket Extension %s", version)
root = join(abspath(dirname(__file__)), "lib")
ext = join(root, os.listdir(root)[0])
retval = hal.loadOneExtension(ext)
if retval != 0:
logger.warn("loading extension may have failed (error=%d)", retval)

View File

@@ -0,0 +1,40 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"hatchling",
"hatch-robotpy~=0.2.1",
]
[project]
name = "robotpy-halsim-ds-socket"
version = "0.0.0"
description = "WPILib simulator DS Socket Extension"
authors = [
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
]
license = "BSD-3-Clause"
dependencies = [
"robotpy-native-wpihal==0.0.0",
"robotpy-native-wpinet==0.0.0",
]
[project.entry-points."robotpy_sim.2027"]
ds-socket = "halsim_ds_socket"
[tool.hatch.build.hooks.robotpy]
version_file = "halsim_ds_socket/version.py"
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "halsim_ds_socket"
group_id = "org.wpilib.halsim"
repo_url = ""
version = "0.0.0"
use_headers = false
extract_to = "halsim_ds_socket"
libs = ["halsim_ds_socket"]
[tool.hatch.build.targets.wheel]
packages = ["halsim_ds_socket"]

View File

@@ -0,0 +1,18 @@
import ctypes
import pathlib
def test_halsim_ds_socket():
# dependencies
import native.wpihal._init_robotpy_native_wpihal
import native.wpinet._init_robotpy_native_wpinet
import halsim_ds_socket as base
loaded = 0
for fname in (pathlib.Path(base.__file__).parent / "lib").iterdir():
if fname.is_file() and fname.suffix in (".dll", ".dylib", ".so"):
ctypes.CDLL(str(fname))
loaded += 1
assert loaded