- Host Configuration
- Runtime Node Configuration
- SDF Configuration
- Logfile Management
- Managing the Runtime
- Application Code Portability
- Building C Examples
- Building C++ Examples
- Building a Node
- Clone Example Repos
- Coordinate Frames
- Diagnostic Trouble Codes
- Extending the Data Model
- IDE Setup
- Logged vs Source vs Published Video Parameters
- MATLAB to Export - BETA
- PolySync Messages
- ROS Bridge
- Release Notes
- Standard Units
- Dynamic Driver/HW Interface Development
- Application Development
Connect USB Webcam
This tutorial will introduce you to the process of connecting a webcam sensor.
When working with sensors it is important to remember that every sensor is slightly different─some require a sensor identifier, or additional Linux configuration requirements, etc. The requirements for specific sensors can be found under Supported Sensors in the help center.
1. Define your node using the PolySync SDF Configurator
The first step towards connecting a sensor is to define your node using the PolySync. You can either use the Ubuntu icon or enter the following command into a Terminal window to start the SDF Configurator:
Now you can add a new node. In the bottom left corner of the SDF Configurator window click “Add Sensor Node.” A dialog box will appear with a dropdown list for all of the currently supported sensor types. Choose “video-device” from this list.
After pressing “OK,” all of the parameters for the sensor will be visible. If using multiple sensors, be sure to name the sensor to avoid confusion.
The above Configurator allows you to manage three main categories of parameters, which help you with everything from physical device settings to file paths:
- Node Configuration
- Application settings, such as the file path for the the device driver
- Sensor Configuration
- Physical settings of the device, such as XYZ placement on the vehicle
- Published and logged: Pixel format, image width/height, frames per second
- Optional extended H264 encoder parameters
- IO Configuration
- IO settings for the data, such as video frames per second
- Source: Pixel format, image width/height, frames per second
- Source device configuration parameters
Within the SDF Configurator all changes are saved after pressing “Enter.”
Copy the node’s SDF ID. This will be used later to start the node.
2. Enumerate and assess the video device name
When the video device is connected to the Linux machine the Video4Linux drivers will enumerate the device name, similar to /dev/video0.
When the device is initialized during the boot process or connected to the host machine you will see it in
/var/log/syslog or you can run
dmesg in a terminal before connecting the device to your host machine.
Once the device is connected to the host machine, you can add it in the SDF Configurator
IO Configuration panel under “Video Device 0 Name” field.
You can also see all video devices by doing:
$ ls /dev/video*
3. Starting PolySync manager
Next, you’re going to call the PolySync manager daemon and signal it to start the wall clock:
Once that has been completed, you can start the node manually by using the
-n flag to reference the “Node ID:” in the Node Configuration section of the SDF Configurator:
$ polysync-core-dynamic-driver -n 1
In an “OK” state, this would be the last line the node prints:
2018-04-15 10:57:47.09s DEBUG [video-device-1688894064433460] - transition to state: OK - timestamp: 1473994633468834
If any errors are being returned, you can use the
-u flag to update this node’s supported parameters in the SDF:
$ polysync-core-dynamic-driver -n 1 -u
4. Visualize data using Studio
You are now able to start PolySyncin order to visualize the image data. Input the following:
Open the video plugin from the button on the plugin loader on the right side of Studio. On the left-hand side of the window you can see the plugin’s control panel. The video device name can be selected from the control panel, and the live input can be seen from the node.
You can visualize the data with a second node by running the image data viewer example:
Congratulations! You have now successfully connected a webcam sensor.