- Host Configuration
- Runtime Node Configuration
- SDF Configuration
- Ecosystem Tools
- Application Development
- Dynamic Driver Development
Connect USB Webcam Tutorial
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 Core SDF Configurator
For detailed steps on setting up the video device Generic Video Device / Webcam sensor article.
The first step towards connecting a sensor is to define your node using the PolySync Core. You can either use the Ubuntu icon or enter the following command into a Terminal window to start the SDF Configurator:
2. Define the node
Define the node using. Use the Ubuntu icon or enter the following command into a terminal window to start the SDF Configurator:
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 cameras, 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
- Displays the Node ID of the sensor
- 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.”
Take note of the node’s Node ID: located in the upper right corner of the “Node Configuration” section. This will be used later to start the node.
3. 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 -l /dev/video*
4. Starting PolySync Core manager
Next, you’re going to call the PolySync Core manager daemon and signal it to start the wall clock:
Start the PolySync Core manager service:
$ sudo service polysync-core-manager start
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
5. Visualize data using Studio
You are now able to start PolySync Corein order to visualize the image data. Input the following:
Startto 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.
6. Visualize data outside of PolySync Core Studio
The image data viewer example binds the first image data publisher it finds.
$ cd image_data_viewer $ make $ ./bin/polysync-image-data-viewer
7. Access image data from the Core bus
Use this article to Access Data from the Bus.
To quickly access the
ps_image_data_msg run the following commands in a terminal:
$ polysync-generate node -s ps_image_data_msg $ cd MyNode $ mkdir build && cd build $ cmake .. && make $ ./MyNode
If studio is still in mode you see the contents of ImageDataMessage.
Congratulations! You have now successfully connected a webcam sensor.