Skip to content

Commit

Permalink
looks like python can run examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gerth2 committed Sep 6, 2024
1 parent bbaf120 commit 601d2e7
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 3 deletions.
175 changes: 175 additions & 0 deletions photonlib-python-examples/poseest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# This gitignore has been specially created by the WPILib team.
# If you remove items from this file, intellisense might break.

### C++ ###
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### Gradle ###
.gradle
/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

# # VS Code Specific Java Settings
# DO NOT REMOVE .classpath and .project
.classpath
.project
.settings/
bin/

# IntelliJ
*.iml
*.ipr
*.iws
.idea/
out/

# Fleet
.fleet

# Simulation GUI and other tools window save file
*-window.json
networktables.json

__pycache__
2 changes: 1 addition & 1 deletion photonlib-python-examples/poseest/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ def robotPeriodic(self) -> None:

def teleopPeriodic(self) -> None:
print("memes")
print(version.PHOTONLIB_VERSION)
print(version.PHOTONLIB_VERSION)
92 changes: 92 additions & 0 deletions photonlib-python-examples/poseest/simgui-ds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"keyboardJoysticks": [
{
"axisConfig": [
{
"decKey": 65,
"incKey": 68
},
{
"decKey": 87,
"incKey": 83
},
{
"decKey": 69,
"decayRate": 0.0,
"incKey": 82,
"keyRate": 0.009999999776482582
}
],
"axisCount": 3,
"buttonCount": 4,
"buttonKeys": [
90,
88,
67,
86
],
"povConfig": [
{
"key0": 328,
"key135": 323,
"key180": 322,
"key225": 321,
"key270": 324,
"key315": 327,
"key45": 329,
"key90": 326
}
],
"povCount": 1
},
{
"axisConfig": [
{
"decKey": 74,
"incKey": 76
},
{
"decKey": 73,
"incKey": 75
}
],
"axisCount": 2,
"buttonCount": 4,
"buttonKeys": [
77,
44,
46,
47
],
"povCount": 0
},
{
"axisConfig": [
{
"decKey": 263,
"incKey": 262
},
{
"decKey": 265,
"incKey": 264
}
],
"axisCount": 2,
"buttonCount": 6,
"buttonKeys": [
260,
268,
266,
261,
269,
267
],
"povCount": 0
},
{
"axisCount": 0,
"buttonCount": 0,
"povCount": 0
}
]
}
10 changes: 10 additions & 0 deletions photonlib-python-examples/poseest/simgui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"NTProvider": {
"types": {
"/FMSInfo": "FMSInfo"
}
},
"NetworkTables Info": {
"visible": true
}
}
24 changes: 22 additions & 2 deletions photonlib-python-examples/run.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
@echo off
setlocal
:: To run any example, we want to use photonlib out of the source code in this repo. We'll add it to the PYTHONPATH variable.

:: Check if the first argument is provided
if "%~1"=="" (
echo Error: No example-to-run provided.
exit /b 1
)

:: To run any example, we want to use photonlib out of the source code in this repo.
:: Build the wheel first
pushd %~dp0..\photon-lib\py
if exist build rmdir /S /Q build
python setup.py bdist_wheel
popd

:: Add the output directory to PYTHONPATH to make sure it gets picked up ahead of any other installs
set PHOTONLIBPY_ROOT=%~dp0..\photon-lib\py
set PYTHONPATH=
set PYTHONPATH=%PHOTONLIBPY_ROOT%

:: Move to to the right example folder
cd %~1

:: Run the example
robotpy sim

0 comments on commit 601d2e7

Please sign in to comment.