Skip to content

Commit

Permalink
aim at target example base WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gerth2 committed Sep 6, 2024
1 parent 306a7ff commit 40200dc
Show file tree
Hide file tree
Showing 19 changed files with 1,402 additions and 87 deletions.
34 changes: 22 additions & 12 deletions photonlib-cpp-examples/aimattarget/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ repositories {
jcenter()
}

apply from: "${rootDir}/../shared/examples_common.gradle"

ext {
wpilibVersion = "2025.0.0-alpha-1"
wpimathVersion = wpilibVersion
openCVversion = "4.8.0-2"
}
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = "2024.3.2"
wpi.versions.wpimathVersion = "2024.3.2"

wpi.getVersions().getOpencvVersion().convention(openCVversion);
wpi.getVersions().getWpilibVersion().convention(wpilibVersion);
wpi.getVersions().getWpimathVersion().convention(wpimathVersion);
apply from: "${rootDir}/../shared/examples_common.gradle"

// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project DeployUtils.
Expand Down Expand Up @@ -68,21 +62,36 @@ wpi.sim.addDriverstation()
model {
components {
frcUserProgram(NativeExecutableSpec) {
targetPlatform wpi.platforms.roborio
targetPlatform wpi.platforms.desktop
// We don't need to build for roborio -- if we do, we need to install
// a roborio toolchain every time we build in CI
// Ideally, we'd be able to set the roborio toolchain as optional, but
// I can't figure out how to set that environment variable from build.gradle
// (see https://github.com/wpilibsuite/native-utils/blob/2917c69fb5094e36d499c465f047dab81c68446c/ToolchainPlugin/src/main/java/edu/wpi/first/toolchain/ToolchainGraphBuildService.java#L71)
// for now, commented out

// targetPlatform wpi.platforms.roborio

if (includeDesktopSupport) {
targetPlatform wpi.platforms.desktop
}

sources.cpp {
source {
srcDir 'src/main/cpp'
include '**/*.cpp', '**/*.cc'
}
exportedHeaders {
srcDir 'src/main/include'
}
}

// Set deploy task to deploy this component
deployArtifact.component = it

// Enable run tasks for this component
wpi.cpp.enableExternalTasks(it)

// Enable simulation for this component
wpi.sim.enable(it)
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
wpi.cpp.vendor.cpp(it)
Expand All @@ -100,6 +109,7 @@ model {
}
}

// Enable run tasks for this component
wpi.cpp.enableExternalTasks(it)

wpi.cpp.vendor.cpp(it)
Expand Down
1 change: 1 addition & 0 deletions photonlib-cpp-examples/aimattarget/networktables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
7 changes: 5 additions & 2 deletions photonlib-cpp-examples/aimattarget/simgui-ds.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
"incKey": 83
},
{
"decKey": 69,
"decayRate": 0.0,
"incKey": 82,
"keyRate": 0.009999999776482582
},
{},
{
"decKey": 81,
"incKey": 69
}
],
"axisCount": 6,
Expand Down
48 changes: 31 additions & 17 deletions photonlib-cpp-examples/aimattarget/simgui-window.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,64 @@
{
"Docking": {
"Data": []
},
"MainWindow": {
"GLOBAL": {
"height": "720",
"fps": "120",
"height": "910",
"maximized": "0",
"style": "0",
"userScale": "2",
"width": "1280",
"xpos": "3124",
"ypos": "324"
"width": "1550",
"xpos": "-1602",
"ypos": "79"
}
},
"Window": {
"###/SmartDashboard/VisionSystemSim-main/Sim Field": {
"Collapsed": "0",
"Pos": "554,10",
"Size": "991,527"
},
"###FMS": {
"Collapsed": "0",
"Pos": "5,540",
"Size": "283,146"
"Pos": "12,604",
"Size": "202,214"
},
"###Joysticks": {
"Collapsed": "0",
"Pos": "250,465",
"Size": "796,155"
"Pos": "278,685",
"Size": "976,219"
},
"###Keyboard 0 Settings": {
"###NetworkTables": {
"Collapsed": "0",
"Pos": "10,50",
"Size": "300,560"
"Pos": "353,479",
"Size": "830,620"
},
"###NetworkTables": {
"###NetworkTables Info": {
"Collapsed": "0",
"Pos": "250,277",
"Size": "750,185"
"Pos": "315,527",
"Size": "750,145"
},
"###Other Devices": {
"Collapsed": "0",
"Pos": "1025,20",
"Size": "250,695"
},
"###Plot <0>": {
"Collapsed": "0",
"Pos": "113,22",
"Size": "448,400"
},
"###System Joysticks": {
"Collapsed": "0",
"Pos": "5,350",
"Size": "192,218"
"Size": "232,254"
},
"###Timing": {
"Collapsed": "0",
"Pos": "5,150",
"Size": "135,127"
"Size": "162,142"
},
"Debug##Default": {
"Collapsed": "0",
Expand All @@ -54,7 +68,7 @@
"Robot State": {
"Collapsed": "0",
"Pos": "5,20",
"Size": "92,99"
"Size": "109,134"
}
}
}
159 changes: 158 additions & 1 deletion photonlib-cpp-examples/aimattarget/simgui.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,164 @@
{
"NTProvider": {
"types": {
"/FMSInfo": "FMSInfo"
"/FMSInfo": "FMSInfo",
"/SmartDashboard/VisionSystemSim-main/Sim Field": "Field2d"
},
"windows": {
"/SmartDashboard/VisionSystemSim-main/Sim Field": {
"EstimatedRobot": {
"arrowWeight": 3.0,
"length": 0.800000011920929,
"selectable": false,
"weight": 3.0,
"width": 0.800000011920929
},
"EstimatedRobotModules": {
"arrows": false,
"image": "swerve_module.png",
"length": 0.30000001192092896,
"selectable": false,
"width": 0.30000001192092896
},
"Robot": {
"arrowColor": [
1.0,
1.0,
1.0,
255.0
],
"arrowWeight": 2.0,
"color": [
1.0,
1.0,
1.0,
255.0
],
"length": 0.800000011920929,
"selectable": false,
"weight": 2.0,
"width": 0.800000011920929
},
"VisionEstimation": {
"arrowColor": [
0.0,
0.6075949668884277,
1.0,
255.0
],
"arrowWeight": 2.0,
"color": [
0.0,
0.6075949668884277,
1.0,
255.0
],
"selectable": false,
"weight": 2.0
},
"apriltag": {
"arrows": false,
"image": "tag-green.png",
"length": 0.6000000238418579,
"width": 0.5
},
"bottom": 1476,
"cameras": {
"arrowColor": [
0.29535865783691406,
1.0,
0.9910804033279419,
255.0
],
"arrowSize": 19,
"arrowWeight": 3.0,
"length": 1.0,
"style": "Hidden",
"weight": 1.0,
"width": 1.0
},
"height": 8.210550308227539,
"image": "2023-field.png",
"left": 150,
"right": 2961,
"top": 79,
"visibleTargetPoses": {
"arrows": false,
"image": "tag-blue.png",
"length": 0.5,
"selectable": false,
"width": 0.4000000059604645
},
"width": 16.541748046875,
"window": {
"visible": true
}
}
}
},
"NetworkTables": {
"transitory": {
"CameraPublisher": {
"YOUR CAMERA NAME-processed": {
"open": true,
"string[]##v_/CameraPublisher/YOUR CAMERA NAME-processed/streams": {
"open": true
}
},
"open": true
},
"SmartDashboard": {
"VisionSystemSim-main": {
"open": true
},
"open": true
}
}
},
"NetworkTables Info": {
"visible": true
},
"Plot": {
"Plot <0>": {
"plots": [
{
"axis": [
{
"autoFit": true
}
],
"backgroundColor": [
0.0,
0.0,
0.0,
0.8500000238418579
],
"height": 332,
"series": [
{
"color": [
0.2980392277240753,
0.44705885648727417,
0.6901960968971252,
1.0
],
"id": "NT:/SmartDashboard/GPLauncher Act Spd (RPM)"
},
{
"color": [
0.8666667342185974,
0.5176470875740051,
0.32156863808631897,
1.0
],
"id": "NT:/SmartDashboard/GPLauncher Des Spd (RPM)"
}
]
}
],
"window": {
"visible": false
}
}
}
}
Loading

0 comments on commit 40200dc

Please sign in to comment.