Updated Using an External Webcam with Control Hub (markdown)
@ -1,11 +1,7 @@
|
|||||||
## Introduction
|
## Introduction
|
||||||
The FTC Game Manual Part 1 allows USB Video Class (UVC) compatible cameras for robot vision tasks.
|
The FTC Game Manual Part 1 allows USB Video Class (UVC) compatible cameras for robot vision tasks.
|
||||||
|
|
||||||
If you are using a Control Hub, then you will need to use an external webcam, since the Control Hub does not include a camera.
|
If you are using a Control Hub, then you will need to use an external webcam, since the Control Hub does not include a built-in camera.
|
||||||
|
|
||||||
If you are using an Android phone as your Robot Controller, then you have the option of using an external webcam instead of the phone's built-in camera. This allows the camera and RC phone to each be placed in a convenient, safe and effective location on the robot. However, this also adds cost and weight, and the robot wiring is more complex.
|
|
||||||
|
|
||||||
Video feed and image preview are available on the RC and DS devices with a webcam.
|
|
||||||
|
|
||||||
## Type of External Camera
|
## Type of External Camera
|
||||||
|
|
||||||
@ -17,64 +13,63 @@ Theoretically, any USB Video Class (UVC) camera should work with the FTC system.
|
|||||||
|
|
||||||
Calibrating a UVC camera is an optional, advanced task. Instructions for creating a calibration file are in the comments of the [_teamwebcamcalibrations.xml_](https://github.com/ftctechnh/ftc_app/blob/master/TeamCode/src/main/res/xml/teamwebcamcalibrations.xml) file in the ftc_app project folder (visit this [link](https://github.com/ftctechnh/ftc_app/blob/master/TeamCode/src/main/res/xml/teamwebcamcalibrations.xml) for an online copy of the file).
|
Calibrating a UVC camera is an optional, advanced task. Instructions for creating a calibration file are in the comments of the [_teamwebcamcalibrations.xml_](https://github.com/ftctechnh/ftc_app/blob/master/TeamCode/src/main/res/xml/teamwebcamcalibrations.xml) file in the ftc_app project folder (visit this [link](https://github.com/ftctechnh/ftc_app/blob/master/TeamCode/src/main/res/xml/teamwebcamcalibrations.xml) for an online copy of the file).
|
||||||
|
|
||||||
## Control Hub
|
## Connecting the Camera
|
||||||
### Connecting the Camera
|
|
||||||
|
|
||||||
The UVC camera plugs directly into the USB 2.0 port on the REV Control Hub. Unlike the REV Expansion Hub, there is no need for an external USB hub.
|
The UVC camera plugs directly into the USB 2.0 port on the REV Control Hub. Unlike the REV Expansion Hub, there is no need for an external USB hub.
|
||||||
|
|
||||||
<p align="center">[[/images/Using-an-External-Webcam/USB-camera-Control-Hub.jpg|Control Hub and webcam.]]<p>
|
<p align="center">[[/images/Using-an-External-Webcam-with-Control-Hub/USB-camera-Control-Hub.jpg|Control Hub and webcam.]]<p>
|
||||||
|
|
||||||
### Camera Configuration
|
## Camera Configuration
|
||||||
|
|
||||||
Before using the external camera, it must be added to the active configuration file as a USB-connected device.
|
Before using the external camera, it must be added to the active configuration file as a USB-connected device.
|
||||||
|
|
||||||
Use the Configure Robot menu item on the paired Driver Station phone to add the webcam as a USB-connected device to an existing or newly created configuration file. Note that the Scan operation for the Configure Robot activity should detect the webcam and give it a default name of "Webcam 1".
|
Use the Configure Robot menu item on the paired Driver Station phone to add the webcam as a USB-connected device to an existing or newly created configuration file. Note that the Scan operation for the Configure Robot activity should detect the webcam and give it a default name of "Webcam 1".
|
||||||
|
|
||||||
<p align="center">[[/images/Using-an-External-Webcam/webcam-config-CH.jpg]]<p>
|
<p align="center">[[/images/Using-an-External-Webcam-with-Control-Hub/webcam-config-CH.jpg]]<p>
|
||||||
|
|
||||||
You can keep this default name (the sample modes reference this name) or change it. If you change the webcam name, make sure your op modes refer to this new name.
|
You can keep this default name (the sample modes reference this name) or change it. If you change the webcam name, make sure your op modes refer to this new name.
|
||||||
|
|
||||||
### Sample Op Modes
|
## Sample Op Modes
|
||||||
|
|
||||||
When the configuration has been saved and activated, the external UVC camera can be programmed for robot vision tasks.
|
When the configuration has been saved and activated, the external UVC camera can be programmed for robot vision tasks.
|
||||||
|
|
||||||
The FTC software offers "webcam" versions of its sample Blocks and Java Op Modes, showing how to use the external UVC camera for Vuforia or TensorFlow operations.
|
The FTC software offers "webcam" versions of its sample Blocks and Java Op Modes, showing how to use the external UVC camera for Vuforia or TensorFlow operations.
|
||||||
|
|
||||||
<p align="center">[[/images/Using-an-External-Webcam/blockswebcam.jpg]]<p>
|
<p align="center">[[/images/Using-an-External-Webcam-with-Control-Hub/blockswebcam.jpg]]<p>
|
||||||
|
|
||||||
Before editing an Op Mode, verify that the intended configuration (with camera) is active. Also verify that the name referenced in the Op Mode matches the name specified in the configuration file.
|
Before editing an Op Mode, verify that the intended configuration (with camera) is active. Also verify that the name referenced in the Op Mode matches the name specified in the configuration file.
|
||||||
|
|
||||||
### Image Preview
|
## Image Preview
|
||||||
|
|
||||||
The FTC apps provide camera preview for ‘stream-enabled’ Op Modes using Vuforia or TensorFlow Object Detection (TFOD).
|
The FTC apps provide camera preview for ‘stream-enabled’ Op Modes using Vuforia or TensorFlow Object Detection (TFOD).
|
||||||
|
|
||||||
On a paired Driver Station phone, with the camera connected and configured, select a stream-enabled Op Mode. Press the INIT button, and wait briefly for streaming software to initialize; do not press the START button. Instead open the main menu (the 3 dots in upper right hand corner of the screen) and select Camera Stream. This option appears only at this time, during which the game pads and START button are disabled for safety.
|
On a paired Driver Station phone, with the camera connected and configured, select a stream-enabled Op Mode. Press the INIT button, and wait briefly for streaming software to initialize; do not press the START button. Instead open the main menu (the 3 dots in upper right hand corner of the screen) and select Camera Stream. This option appears only at this time, during which the game pads and START button are disabled for safety.
|
||||||
|
|
||||||
<p align="center">[[/images/Using-an-External-Webcam/DS-webcam-preview-CH-1.jpg]]<p>
|
<p align="center">[[/images/Using-an-External-Webcam-with-Control-Hub/DS-webcam-preview-CH-1.jpg]]<p>
|
||||||
|
|
||||||
The camera image will appear on the Driver Station screen. Manually touch the image to refresh it. To preserve bandwidth, only one frame is sent at a time.
|
The camera image will appear on the Driver Station screen. Manually touch the image to refresh it. To preserve bandwidth, only one frame is sent at a time.
|
||||||
|
|
||||||
<p align="center">[[/images/Using-an-External-Webcam/DS-webcam-preview-CH-2.jpg]]<p>
|
<p align="center">[[/images/Using-an-External-Webcam-with-Control-Hub/DS-webcam-preview-CH-2.jpg]]<p>
|
||||||
|
|
||||||
This option may be used to adjust the camera, with frequent manual image refreshing as needed. When finished, open the main menu and select Camera Stream again to turn off the preview. The preview image will close, the game pads will be enabled, and the START button may be pressed to continue running the Op Mode.
|
This option may be used to adjust the camera, with frequent manual image refreshing as needed. When finished, open the main menu and select Camera Stream again to turn off the preview. The preview image will close, the game pads will be enabled, and the START button may be pressed to continue running the Op Mode.
|
||||||
|
|
||||||
<p align="center">[[/images/Using-an-External-Webcam/DS-webcam-preview-CH-3.jpg]]<p>
|
<p align="center">[[/images/Using-an-External-Webcam-with-Control-Hub/DS-webcam-preview-CH-3.jpg]]<p>
|
||||||
|
|
||||||
**Important Note:** Because the Camera Stream feature is only available during the INIT phase of an op mode, you must ensure that the Vuforia library is activated in your Op Mode _**before**_ the waitForStartCommand:
|
**Important Note:** Because the Camera Stream feature is only available during the INIT phase of an op mode, you must ensure that the Vuforia library is activated in your Op Mode _**before**_ the waitForStartCommand:
|
||||||
|
|
||||||
<p align="center">[[/images/Using-an-External-Webcam/activateBeforeWaitForStart.jpg]]<p>
|
<p align="center">[[/images/Using-an-External-Webcam-with-Control-Hub/activateBeforeWaitForStart.jpg]]<p>
|
||||||
|
|
||||||
If you do not see the Camera Stream option in your main menu on your Driver Station, then verify that the Vuforia function is activated before the waitForStart command in your Op Mode. Also make sure you've given the system enough time to initialize the Vuforia software before you check to see if Camera Stream is available.
|
If you do not see the Camera Stream option in your main menu on your Driver Station, then verify that the Vuforia function is activated before the waitForStart command in your Op Mode. Also make sure you've given the system enough time to initialize the Vuforia software before you check to see if Camera Stream is available.
|
||||||
|
|
||||||
### External HDMI Monitor
|
## External HDMI Monitor
|
||||||
|
|
||||||
Alternatively, camera output can be viewed on a display monitor or other device plugged into the HDMI port on the REV Control Hub.
|
Alternatively, camera output can be viewed on a display monitor or other device plugged into the HDMI port on the REV Control Hub.
|
||||||
|
|
||||||
<p align="center">[[/images/Using-an-External-Webcam/HDMIMonitor.jpg]]<p>
|
<p align="center">[[/images/Using-an-External-Webcam-with-Control-Hub/HDMIMonitor.jpg]]<p>
|
||||||
|
|
||||||
**Important Note:** While a portable display monitor can be used to view or troubleshoot the camera stream on your Control Hub, teams are not allowed to have a portable display monitor connected to their Control Hub during a match.
|
**Important Note:** While a portable display monitor can be used to view or troubleshoot the camera stream on your Control Hub, teams are not allowed to have a portable display monitor connected to their Control Hub during a match.
|
||||||
|
|
||||||
### Advanced Users
|
## Advanced Users
|
||||||
|
|
||||||
For custom streams, advanced users of Android Studio may consult the [API documentation](https://first-tech-challenge.github.io/SkyStone/doc/javadoc/index.html) for [CameraStreamClient](https://first-tech-challenge.github.io/SkyStone/doc/javadoc/org/firstinspires/ftc/robotcore/external/stream/CameraStreamClient.html), [CameraStreamServer](https://first-tech-challenge.github.io/SkyStone/doc/javadoc/org/firstinspires/ftc/robotcore/external/stream/CameraStreamServer.html) and [CameraStreamSource](https://first-tech-challenge.github.io/SkyStone/doc/javadoc/org/firstinspires/ftc/robotcore/external/stream/CameraStreamSource.html) classes.
|
For custom streams, advanced users of Android Studio may consult the [API documentation](https://first-tech-challenge.github.io/SkyStone/doc/javadoc/index.html) for [CameraStreamClient](https://first-tech-challenge.github.io/SkyStone/doc/javadoc/org/firstinspires/ftc/robotcore/external/stream/CameraStreamClient.html), [CameraStreamServer](https://first-tech-challenge.github.io/SkyStone/doc/javadoc/org/firstinspires/ftc/robotcore/external/stream/CameraStreamServer.html) and [CameraStreamSource](https://first-tech-challenge.github.io/SkyStone/doc/javadoc/org/firstinspires/ftc/robotcore/external/stream/CameraStreamSource.html) classes.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user