Connecting To A USB 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](/articles/?p=722) 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 SDF Configurator . You can either use the Ubuntu icon or enter the following command into a Terminal window to start the SDF Configurator: ```bash $ polysync-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. ![Connecting Cam 1](https://help.polysync.io/releases/2.0.7//wp-content/uploads/2016/07/cam1.png) 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_. Once the device is enumerated on the host machine, you can assess it in the IO Configuration panel under "Video Device 0 Name." By inputting the following into your terminal window, you can compare the output of the Linux _syslog_ and _dmesg_ tools against the device names in the _/dev/_ directory: ```bash $ cd /dev/ $ ls ``` ### 3. Starting PolySync manager Next, you’re going to call the PolySync manager daemon and signal it to start the wall clock: ```bash $ polysync-manager ``` 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: ```bash $ polysync-dynamic-driver -n 1 ``` In an "OK" state, this would be the last line the node prints: ```bash 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: ```bash $ polysync-dynamic-driver -n 1 -u ``` ### 4. Visualize data using Studio You are now able to start PolySync Studio in order to visualize the image data. Input the following: ```bash $ polysync-studio ``` 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. ![Connecting Cam 2](/wp-content/uploads/2016/07/Screenshot-from-2016-11-16-111318.png) You can visualize the data with a second node by running the image data viewer example: ```bash $ polysync-image-data-viewer ``` #### Conclusion Congratulations! You have now successfully connected a webcam sensor.