diff --git a/source/docs/programming/photonlib/index.rst b/source/docs/programming/photonlib/index.rst index b5ad4e16..7fcf0343 100644 --- a/source/docs/programming/photonlib/index.rst +++ b/source/docs/programming/photonlib/index.rst @@ -12,3 +12,4 @@ PhotonLib: Robot Code Interface controlling-led simulation hardware-in-the-loop-sim + labview/index diff --git a/source/docs/programming/photonlib/labview/camera-controls.rst b/source/docs/programming/photonlib/labview/camera-controls.rst new file mode 100644 index 00000000..772fbd98 --- /dev/null +++ b/source/docs/programming/photonlib/labview/camera-controls.rst @@ -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 \ No newline at end of file diff --git a/source/docs/programming/photonlib/labview/getting-target-data.rst b/source/docs/programming/photonlib/labview/getting-target-data.rst new file mode 100644 index 00000000..36312e0a --- /dev/null +++ b/source/docs/programming/photonlib/labview/getting-target-data.rst @@ -0,0 +1,61 @@ +Getting Target Data +=================== + +Getting The Latest Result +------------------------ + +What is a Photon Pipeline Result +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A ``PhotonPipelineResult`` is a bundle that contains all information about currently detected targets from a camera. You can retrieve the latest pipeline result using ``PhotonCamera_GetLatestResult.vi`` + +.. image:: images/get_latest_result.png + +Checking for Existence of Targets +-------------------- + +``PhotonCamera_GetLatestResult.vi`` will output a boolean named ``hasTargets?`` to inform the user as to whether the result contains any targets. + +.. image:: images/has_targets_2.png + +``PhotonPipelineResult_HasTargets?.vi`` can also be used to check for the existence of targets. + +.. image:: images/has_targets.png + + +Getting an Array of Targets +--------------------------- + +What is a Photon Tracked Target? +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A tracked target contains information about a target from a pipeline result. This information includes yaw, pitch, area, and robot relative pose. + +Each pipeline result contains an array of targets. Use LabVIEW's ``Unbunlde by name`` node to get access to the array of targets. + +.. image:: images/get_targets.png + +Getting The Best Target +----------------------- + +You can get the `best target `_ using ``PhotonPipelineResult_GetBestTarget.vi`` + +.. image:: images/get_best_target.png + +Getting Target By ID +-------------------- + +If you are using an AprilTag pipeline you can use ``PhotonPipelineResult_GetBestTargetById.vi`` will return a target with a specified ID. + +.. 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 `_. + +.. image:: images/get_data.png \ No newline at end of file diff --git a/source/docs/programming/photonlib/labview/images/distance_to_target.png b/source/docs/programming/photonlib/labview/images/distance_to_target.png new file mode 100644 index 00000000..e7f329db Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/distance_to_target.png differ diff --git a/source/docs/programming/photonlib/labview/images/get_best_target.png b/source/docs/programming/photonlib/labview/images/get_best_target.png new file mode 100644 index 00000000..325ad0c2 Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/get_best_target.png differ diff --git a/source/docs/programming/photonlib/labview/images/get_data.png b/source/docs/programming/photonlib/labview/images/get_data.png new file mode 100644 index 00000000..a4e8ec9c Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/get_data.png differ diff --git a/source/docs/programming/photonlib/labview/images/get_latency.png b/source/docs/programming/photonlib/labview/images/get_latency.png new file mode 100644 index 00000000..695b650b Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/get_latency.png differ diff --git a/source/docs/programming/photonlib/labview/images/get_latest_result.png b/source/docs/programming/photonlib/labview/images/get_latest_result.png new file mode 100644 index 00000000..e5f73ad0 Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/get_latest_result.png differ diff --git a/source/docs/programming/photonlib/labview/images/get_target_by_id.png b/source/docs/programming/photonlib/labview/images/get_target_by_id.png new file mode 100644 index 00000000..473689ca Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/get_target_by_id.png differ diff --git a/source/docs/programming/photonlib/labview/images/get_targets.png b/source/docs/programming/photonlib/labview/images/get_targets.png new file mode 100644 index 00000000..27c25938 Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/get_targets.png differ diff --git a/source/docs/programming/photonlib/labview/images/has_targets.png b/source/docs/programming/photonlib/labview/images/has_targets.png new file mode 100644 index 00000000..8052ef0a Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/has_targets.png differ diff --git a/source/docs/programming/photonlib/labview/images/has_targets_2.png b/source/docs/programming/photonlib/labview/images/has_targets_2.png new file mode 100644 index 00000000..62e6f13d Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/has_targets_2.png differ diff --git a/source/docs/programming/photonlib/labview/images/result_equals.png b/source/docs/programming/photonlib/labview/images/result_equals.png new file mode 100644 index 00000000..2bba1635 Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/result_equals.png differ diff --git a/source/docs/programming/photonlib/labview/images/set_driver_mode.png b/source/docs/programming/photonlib/labview/images/set_driver_mode.png new file mode 100644 index 00000000..96fd3ebb Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/set_driver_mode.png differ diff --git a/source/docs/programming/photonlib/labview/images/set_led_mode.png b/source/docs/programming/photonlib/labview/images/set_led_mode.png new file mode 100644 index 00000000..c5a4cd37 Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/set_led_mode.png differ diff --git a/source/docs/programming/photonlib/labview/images/set_pipeline_index.png b/source/docs/programming/photonlib/labview/images/set_pipeline_index.png new file mode 100644 index 00000000..7352827e Binary files /dev/null and b/source/docs/programming/photonlib/labview/images/set_pipeline_index.png differ diff --git a/source/docs/programming/photonlib/labview/index.rst b/source/docs/programming/photonlib/labview/index.rst new file mode 100644 index 00000000..68f93b10 --- /dev/null +++ b/source/docs/programming/photonlib/labview/index.rst @@ -0,0 +1,17 @@ +PhotonVisionLabVIEW (Unofficial) +================================= + +What is PhotonVisionLabVIEW +---------------------------- +PhotonVisionLabVIEW is a third-party LabVIEW Port of the PhotonVision library made by `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. because of this the main development team will not be able provide support. Issues / questions should be reported at https://github.com/jsimpso81/PhotonVisionLabVIEW/issues or on ChiefDelphi. + +.. toctree:: + :maxdepth: 1 + + installing + getting-target-data + using-target-data + camera-controls \ No newline at end of file diff --git a/source/docs/programming/photonlib/labview/installing.rst b/source/docs/programming/photonlib/labview/installing.rst new file mode 100644 index 00000000..f72f6c2a --- /dev/null +++ b/source/docs/programming/photonlib/labview/installing.rst @@ -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 PhotonVisionLib. Then click the REMOVE button. The uninstall should start. It should take 5 minutes or less. \ No newline at end of file diff --git a/source/docs/programming/photonlib/labview/using-target-data.rst b/source/docs/programming/photonlib/labview/using-target-data.rst new file mode 100644 index 00000000..7c7e3452 --- /dev/null +++ b/source/docs/programming/photonlib/labview/using-target-data.rst @@ -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 \ No newline at end of file