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

Add PhotonVisionLabVIEW docs #256

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions source/docs/programming/photonlib/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ PhotonLib: Robot Code Interface
driver-mode-pipeline-index
controlling-led
simulation
labview/index
23 changes: 23 additions & 0 deletions source/docs/programming/photonlib/labview/camera-controls.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Driver Mode Pipeline Index And LED Mode
=======================================

Set Driver Mode
---------------

Toggle driver mode using ``PhotonCamera_SetDriverMode.vi``.

.. image:: images/set_driver_mode.png

Set Pipeline Index
---------------

The same can be done to change the pipeline index by using ``PhotonCamera_SetPipelineIndex.vi``.

.. image:: images/set_pipeline_index.png

Set LED Mode
---------------

And the LED mode with ``PhotonCamera_SetLEDMode.vi``.

.. image:: images/set_led_mode.png
53 changes: 53 additions & 0 deletions source/docs/programming/photonlib/labview/getting-target-data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Getting Target Data
mdurrani808 marked this conversation as resolved.
Show resolved Hide resolved
===================

Getting The Latest Result
mcm001 marked this conversation as resolved.
Show resolved Hide resolved
------------------------

Use ``PhotonCamera_GetLatestResult.vi`` to get the latest pipeline result.

.. image:: images/get_latest_result.png


Checking For Targets
--------------------

Check if the pipeline has targets by using ``PhotonPipelineResult_HasTargets?.vi``.

.. image:: images/has_targets.png

``PhotonCamera_GetLatestResult.vi`` will also return if the pipeline has targets.

.. image:: images/has_targets_2.png

Getting an Array of Targets
---------------------------

Each pipeline result will contain an array of targets to get that array use an unbunlde by name node and select targets.
mdurrani808 marked this conversation as resolved.
Show resolved Hide resolved

.. image:: images/get_targets.png

Getting The Best Target
-----------------------

``PhotonPipelineResult_GetBestTarget.vi`` will return the best target from a pipeline result.

.. image:: images/get_best_target.png

Getting Target By ID
--------------------

If you are using an april tag pipeline you can use ``PhotonPipelineResult_GetBestTargetById.vi`` to return a target with a specified ID.
mdurrani808 marked this conversation as resolved.
Show resolved Hide resolved

.. image:: images/get_target_by_id.png

Getting Target Data
-------------------
* double ``PhotonTrackedTarget_GetYaw.vi``: The yaw of the target in degrees (positive right).
* double ``PhotonTrackedTarget_GetPitch.vi``: The pitch of the target in degrees (positive up).
* double ``PhotonTrackedTarget_GetArea.vi``: The area (how much of the camera feed the bounding box takes up) as a percent (0-100).
* double ``PhotonTrackedTarget_GetSkew.vi``: The skew of the target in degrees (counter-clockwise positive).
* double[] ``PhotonTrackedTarget_GetConors.vi``: The 4 corners of the minimum bounding box rectangle.
* Transform2d ``PhotonTrackedTarget_GetBestCameraToTarget.vi``: The camera to target transform. See `2d transform documentation here <https://docs.wpilib.org/en/latest/docs/software/advanced-controls/geometry/transformations.html#transform2d-and-twist2d>`_.

.. image:: images/get_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions source/docs/programming/photonlib/labview/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PhotonVisionLabVIEW (Unofficial)
=================================

What is PhotonVisionLabVIEW
----------------------------
PhotonVisionLabVIEW is a third-party LabVIEW Port of the PhotonVision library made by `jsimpso81 <https://github.com/jsimpso81>`_.


.. warning:: This project was not made and is not maintained by the PhotonVision team and may not receive updates as fast and some features may be missing.
mdurrani808 marked this conversation as resolved.
Show resolved Hide resolved

.. toctree::
:maxdepth: 1

installing
getting-target-data
using-target-data
camera-controls
14 changes: 14 additions & 0 deletions source/docs/programming/photonlib/labview/installing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Installing PhotonVisionLabVIEW
================================

Installing
----------
Download the latest install package. These can be found in the Releases section of the github repository. Here is a direct link. https://github.com/jsimpso81/PhotonVisionLabVIEW/releases/latest

Select the .nipkg installation file for the version of LabVIEW being used, then double click it, or right click and select install. Administrative privledges will be needed to perform this installation. Follow the instructions. Usually selection of all the default answers is sufficient. Installation should take 5 minutes or less.

Previous versions do not have to be uninstalled prior to installing a new version. The new version will automatically upgrade the older version.

Removal
-------
To uninstall, open NI Package Manager. Select the Installed tab. Find and highlight JAS_Junk_FRC_TrajLib. Then click the REMOVE button. The uninstall should start. It should take 5 minutes or less.
mdurrani808 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Using Target Data
=================

Calculate Distance to Target
------------------------------

If your camera is at a fixed height on your robot and the height of the target is fixed, you can calculate the distance to the target based on your camera’s pitch and the pitch to the target.

.. image:: images/distance_to_target.png