-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge from https://github.com/robotpy/robotpy-halsim-ws
- Loading branch information
Showing
14 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: dist | ||
|
||
on: | ||
pull_request: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
ci: | ||
uses: robotpy/build-actions/.github/workflows/package-hal-extension.yml@v2024 | ||
secrets: | ||
META_REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
*.pyc | ||
*.egg-info | ||
|
||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
.vscode | ||
|
||
/build | ||
/dist | ||
*.egg-info | ||
|
||
/halsim_ws/version.py | ||
|
||
/halsim_ws/server/_init_server.py | ||
/halsim_ws/server/pkgcfg.py | ||
/halsim_ws/server/include | ||
/halsim_ws/server/lib | ||
|
||
/halsim_ws/client/_init_client.py | ||
/halsim_ws/client/pkgcfg.py | ||
/halsim_ws/client/include | ||
/halsim_ws/client/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
robotpy-halsim-ws | ||
================== | ||
|
||
Installing this package will allow you to utilize the 2020+ WPILib websim from a RobotPy program. | ||
|
||
Usage | ||
----- | ||
|
||
First, install pyfrc. Then run your robot with the 'sim' argument and --ws-server or --ws-client flag: | ||
|
||
# Windows | ||
py -3 ./robot.py sim --ws-server | ||
py -3 ./robot.py sim --ws-client | ||
|
||
# Linux/OSX | ||
python3 robot.py sim --ws-server | ||
python3 robot.py sim --ws-client | ||
|
||
WPILib's documentation for using the simulator can be found at http://docs.wpilib.org/en/latest/docs/software/wpilib-tools/robot-simulation/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .main import loadExtension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import logging | ||
import os | ||
from os.path import abspath, dirname, join | ||
|
||
logger = logging.getLogger("halsim_ws.client") | ||
|
||
|
||
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 websim client %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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .main import loadExtension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import logging | ||
import os | ||
from os.path import abspath, dirname, join | ||
|
||
logger = logging.getLogger("halsim_ws.server") | ||
|
||
|
||
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 websim server %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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
[tool.robotpy-build.metadata] | ||
name = "robotpy-halsim-ws" | ||
description = "WPILib simulator websim Extensions" | ||
author = "RobotPy Development Team" | ||
author_email = "robotpy@googlegroups.com" | ||
url = "https://github.com/robotpy/robotpy-halsim-gui" | ||
license = "BSD-3-Clause" | ||
install_requires = [ | ||
"robotpy-hal~=2024.0.0b2", | ||
"robotpy-wpinet~=2024.0.0b2", | ||
] | ||
|
||
[tool.robotpy-build.metadata.entry_points] | ||
robotpysimext = [ | ||
"ws-server = halsim_ws.server", | ||
"ws-client = halsim_ws.client", | ||
] | ||
|
||
|
||
[build-system] | ||
requires = [ | ||
"robotpy-build<2025.0.0,~=2024.0.0b1", | ||
"robotpy-hal~=2024.0.0b2", | ||
"robotpy-wpinet~=2024.0.0b2", | ||
] | ||
|
||
[tool.robotpy-build] | ||
base_package = "halsim_ws" | ||
|
||
[tool.robotpy-build.wrappers."halsim_ws.server".maven_lib_download] | ||
artifact_id = "halsim_ws_server" | ||
group_id = "edu.wpi.first.halsim" | ||
# repo_url = "https://frcmaven.wpi.edu/artifactory/release" | ||
repo_url = "https://frcmaven.wpi.edu/artifactory/release" | ||
version = "2024.1.1-beta-2" | ||
|
||
dlopenlibs = ["halsim_ws_server"] | ||
|
||
[tool.robotpy-build.wrappers."halsim_ws.server"] | ||
name = "server" | ||
depends = ["wpiHal", "wpinet"] | ||
|
||
[tool.robotpy-build.wrappers."halsim_ws.client".maven_lib_download] | ||
artifact_id = "halsim_ws_client" | ||
group_id = "edu.wpi.first.halsim" | ||
# repo_url = "https://frcmaven.wpi.edu/artifactory/release" | ||
repo_url = "https://frcmaven.wpi.edu/artifactory/release" | ||
version = "2024.1.1-beta-2" | ||
|
||
dlopenlibs = ["halsim_ws_client"] | ||
|
||
[tool.robotpy-build.wrappers."halsim_ws.client"] | ||
name = "client" | ||
depends = ["wpiHal", "wpinet", "wpiutil"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from robotpy_build.setup import setup | ||
|
||
setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
from os.path import abspath, dirname | ||
import sys | ||
import subprocess | ||
|
||
if __name__ == "__main__": | ||
root = abspath(dirname(__file__)) | ||
os.chdir(root) | ||
|
||
subprocess.check_call([sys.executable, "-m", "pytest"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# tests the internals | ||
import halsim_ws.client._init_client | ||
|
||
|
||
def test_halsim_ws_client(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# tests the internals | ||
import halsim_ws.server._init_server | ||
|
||
|
||
def test_halsim_ws_server(): | ||
pass |