From bd9759df9bdd14d5cad44fd6ee60d6fab0dfff94 Mon Sep 17 00:00:00 2001 From: Chris Gerth Date: Sat, 16 Dec 2023 15:49:09 -0600 Subject: [PATCH 1/3] Add build instructions for deploy Because I always forget the command --- .../photonvision/build-instructions.rst | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/docs/contributing/photonvision/build-instructions.rst b/source/docs/contributing/photonvision/build-instructions.rst index 87ba8806..e55ac7d6 100644 --- a/source/docs/contributing/photonvision/build-instructions.rst +++ b/source/docs/contributing/photonvision/build-instructions.rst @@ -93,6 +93,27 @@ Running the following command under the root directory will build the jar under ``gradlew shadowJar`` +Build and Run the Source on a Raspberry Pi Coprocessor +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +As a convinenece, the build has built in `deploy` command which builds, deploys, and starts the current source code on a coprocessor. It is generally intended for Raspberry Pi based coprocessors. + +An architecture override is required to specify the deploy target's architecture. + +.. tab-set:: + + .. tab-item:: Linux + + ``./gradlew deploy -PArchOverride=linuxarm64` + + .. tab-item:: macOS + + ``./gradlew deploy -PArchOverride=linuxarm64`` + + .. tab-item:: Windows (cmd) + + `gradlew deploy -PArchOverride=linuxarm64`` + Using PhotonLib Builds ~~~~~~~~~~~~~~~~~~~~~~ From ad3499b439b796184d96aa0cdd97cb6623823eec Mon Sep 17 00:00:00 2001 From: Chris Gerth Date: Wed, 27 Dec 2023 19:45:23 -0600 Subject: [PATCH 2/3] typeos and adding clean commands --- .../docs/contributing/photonvision/build-instructions.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/docs/contributing/photonvision/build-instructions.rst b/source/docs/contributing/photonvision/build-instructions.rst index e55ac7d6..e1c0577b 100644 --- a/source/docs/contributing/photonvision/build-instructions.rst +++ b/source/docs/contributing/photonvision/build-instructions.rst @@ -104,15 +104,18 @@ An architecture override is required to specify the deploy target's architecture .. tab-item:: Linux - ``./gradlew deploy -PArchOverride=linuxarm64` + ``./gradlew clean`` + ``./gradlew deploy -PArchOverride=linuxarm64`` .. tab-item:: macOS + ``./gradlew clean`` ``./gradlew deploy -PArchOverride=linuxarm64`` .. tab-item:: Windows (cmd) - `gradlew deploy -PArchOverride=linuxarm64`` + ``gradlew clean`` + ``gradlew deploy -PArchOverride=linuxarm64`` Using PhotonLib Builds ~~~~~~~~~~~~~~~~~~~~~~ From 1b756fa554bc9fb347404429a02b3e51bc694979 Mon Sep 17 00:00:00 2001 From: Chris Gerth Date: Thu, 28 Dec 2023 21:00:29 -0600 Subject: [PATCH 3/3] comment and scope creep --- .../photonvision/build-instructions.rst | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/source/docs/contributing/photonvision/build-instructions.rst b/source/docs/contributing/photonvision/build-instructions.rst index e1c0577b..f38bd802 100644 --- a/source/docs/contributing/photonvision/build-instructions.rst +++ b/source/docs/contributing/photonvision/build-instructions.rst @@ -96,7 +96,7 @@ Running the following command under the root directory will build the jar under Build and Run the Source on a Raspberry Pi Coprocessor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -As a convinenece, the build has built in `deploy` command which builds, deploys, and starts the current source code on a coprocessor. It is generally intended for Raspberry Pi based coprocessors. +As a convinenece, the build has built in `deploy` command which builds, deploys, and starts the current source code on a coprocessor. An architecture override is required to specify the deploy target's architecture. @@ -117,6 +117,8 @@ An architecture override is required to specify the deploy target's architecture ``gradlew clean`` ``gradlew deploy -PArchOverride=linuxarm64`` +The ``deploy`` command is tested against Raspberry Pi coprocessors. Other similar coprocessors may work too. + Using PhotonLib Builds ~~~~~~~~~~~~~~~~~~~~~~ @@ -163,10 +165,10 @@ After adding the generated vendordep to your project, add the following to your } -Debugging a local PhotonVision build -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Debugging PhotonVision Running Locally +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -One way is by running the program using gradle with the :code:`--debug-jvm` flag. Run the program with :code:`./gradlew run --debug-jvm`, and attach to it with VSCode by adding the following to launch.json. Note args can be passed with :code:`--args="foobar"`. +One way is by running the program using gradle with the :code:`--debug-jvm` flag. Run the program with :code:`./gradlew run --debug-jvm`, and attach to it with VSCode by adding the following to :code:`launch.json`. Note args can be passed with :code:`--args="foobar"`. .. code-block:: @@ -189,6 +191,39 @@ One way is by running the program using gradle with the :code:`--debug-jvm` flag PhotonVision can also be run using the gradle tasks plugin with :code:`"args": "--debug-jvm"` added to launch.json. + +Debugging PhotonVision Running on a CoProcessor +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set up a VSCode configuration in :code:`launch.json` + +.. code-block:: + + { + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Attach to CoProcessor", + "request": "attach", + "hostName": "photonvision.local", + "port": "5801", + "projectName": "photon-core" + }, + ] + } + +Stop any existing instance of PhotonVision. + +Launch the program with the following additional argument to the JVM: :code:`java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=photonvision.local:5801` + +Once the program says it is listening on port 5801, launch the debug configuration in VSCode. + +The program will wait for the VSCode debugger to attach before proceeding. + Running examples ~~~~~~~~~~~~~~~~