Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Add build instructions for deploy #298

Merged
merged 4 commits into from
Dec 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 62 additions & 3 deletions source/docs/contributing/photonvision/build-instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ 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.

An architecture override is required to specify the deploy target's architecture.

.. tab-set::

.. tab-item:: Linux

``./gradlew clean``
``./gradlew deploy -PArchOverride=linuxarm64``

.. tab-item:: macOS

``./gradlew clean``
``./gradlew deploy -PArchOverride=linuxarm64``

.. tab-item:: Windows (cmd)

``gradlew clean``
``gradlew deploy -PArchOverride=linuxarm64``

The ``deploy`` command is tested against Raspberry Pi coprocessors. Other similar coprocessors may work too.

Using PhotonLib Builds
~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -139,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::

Expand All @@ -165,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
~~~~~~~~~~~~~~~~

Expand Down