This article demonstrates how to connect a sensor to PolySync and use the data the from this sensor. In this example, our sensor will be a generic webcam. We'll use PolySync SDF Configurator to define a node with our sensor, use PolySync Manager to start this node, and finally we'll visualize the data using PolySync Studio.
If you haven't already, start by installing PolySync. We'll be working with PolySync Studio and PolySync Manager so it might be helpful to have an understanding of both of these. Checkout out Replaying Logs and Visualizing Data if you haven't already.
Different kinds of sensors require slightly different workflows to properly configure them with PolySync. For CAN devices the CAN channel and device ID must be known. For USB devices we must know the USB system mount point. For devices connected via Ethernet we must know the device's IP address and then configure our machine's Ethernet device to be on the same subnet.
The on-board webcam that we will be setting up as sensor node is very similar to a USB camera. To learn more about USB camera support and possible parameters checkout out the Generic USB Camera documentation.
PolySync SDF Configurator
The first step to connecting a sensor is to define the node using PolySync Configurator. Let's start the Configurator now.
Next, we want to add a new node which we will configure to receive data from our video device. In the bottom-right corner of the Configurator window click "Add Sensor Node". A dialog will appear with a dropdown list for all the currently supported sensor types. Choose "Video Device" from this list.
After pressing "OK" you will see all the configuration options for this sensor. We can name the sensor to prevent confusion down the road.
The Configurator allows us to manage three main categories of parameters:
- Node Configuration - Application settings such the file path for the the device driver.
- Sensor Configuration - Physical settings of the device, such as XYZ placement on the vehicle.
- IO Configuration - IO settings for the data, such as video frames per second.
PolySync Configurator manages saving for you: all changes you make are saved automatically. After you have configured your video device you can close the Configurator.
Now lets start PolySync Manager and signal it to start the nodes defined in our SDF.
$ polysync-manager -n
Next lets start PolySync Studio.
Once PolySync Studio opens click on the Video plugin tab on the right side of the Studio window. On the left side of the window we will see the Video plugin's options. We can click on our defined video device and see the live input from our node.
You have now successfully configured a sensor node with PolySync and learned how to use Studio to visualize the data from this sensor.
No data from node in PolySync Studio:
Your sensor node may not be configured properly. To verify that PolySync can connect to the sensor we can run the polysync-dynamic-driver tool and specify the node we want to run, in this case our node is defined as node with key value 1.
$ polysync-dynamic-driver -n 1 -o elivingston@HB1067:~/Downloads$ polysync-dynamic-driver -n 1 -o DEBUG : polysync_core : build version 2.0.0-1456499804 DEBUG : polysync_lic : process_features -- license mode: pro - version: 2.99 - expiration: 03/14/2016 DEBUG : polysync_core : created participant - GUID: 0x000600019CCF4F10 d(1688856786063120) DEBUG : polysync_dds : message types loaded: 33 DEBUG : polysync_node : state: INIT - timestamp: 1456706229225355 WARN : polysync_logfile : (1330) -- host interface address is set to 'AUTO' - a valid address is recommended for distributed systems WARN : node : (1000) -- PTP service was not detected - this can cause time alignment problems on distributed systems - it is recommended to use the PolySync PTP Service DEBUG : video_device_support : using publish encoder -- src_fmt: 16 - publish fmt: 5 - w/h: 320/240 DEBUG : polysync_node : state: OK - timestamp: 1456706229529822
This will start the driver for the device defined on the node and output log messages from the device. This allows us to get more information about the device and check that PolySync can can successfully start the node. In the output above we can see that the state of the PolySync node is "OK"