Clone Example Repos

There are two repositories available that contain all of the API and application examples for PolySync.

Dependencies

A few dependencies will need to be installed to clone and build the projects:

`$ sudo apt-get install git cmake`

C API examples

The repo can be cloned here: https://github.com/PolySync/PolySync-Core-C-Examples.git

`$ git clone https://github.com/PolySync/PolySync-Core-C-Examples.git`

Learn how to build the C examples.

C Examples in the Repo

Example Hardware Dependencies API Description
can_reader Linuxcan Compatible Hardware (Kvaser Leaf Light) Core, Messaging, Node, Node Template, SDF, and CAN Performs a simple CAN read in the OK state. An example of when a node needs to listen to a CAN channel.
can_writer Linuxcan Compatible Hardware (Kvaser Leaf Light) Core, Messaging, Node, Node Template, SDF, and CAN Performs a simple CAN write in the OK state. An example of when a node needs to write to a CAN channel.
data_generator None Core, Messaging, Node, Node Template, and SDF Populates and publishes sample data from a single node onto the PolySync bus. It generates object, RADAR, and LiDAR data.
enumerate_dynamic_drivers None Core, Messaging, Node, Node Template, and SDF Publishes a ps_command_msg to enumerate any dynamic drivers connected to the PolySync bus.
get_set None Core, Messaging, Node, Node Template, and SDF Gets all parameters from all nodes on the bus and prints the resulting parameters
image_data_viewer A Video Device Core, Messaging, SDF, and Video Uses OpenGL to enable a lightweight application for viewing video data. It renders the image data from a node publishing to the bus.
joystick_commander A joystick and a vehicle running PolySync Core, Messaging, Node, and SDF Enables a joystick to control a vehicle.
logfile_iterator None Core, Messaging, Node, SDF, and Logfile Iterates over a specified logfile plog file reading its contents. This application has access to the raw data.
logfile_iterator_for_velodyne None Core, Messaging, Node, SDF, and Logfile Iterates over a Velodyne LiDAR logfile stored as a ps_byte_array_msg in a plog file.
logfile_queue_reader None Core, Messaging, Node, SDF, and Logfile A node that replays a PolySync logfile using the message queue. You would use this if you wanted to filter or pre-process the sensor data before publishing it to the bus.
logfile_reader None Core, Messaging, Node, SDF, and Logfile Opens and reads a PolySync logfile plog file for replay.
logfile_to_pcap_convertor None Core, Messaging, Node, SDF, and Logfile Converts a ps_byte_array_msg from a Velodyne sensor to a pcap formatted file. This example can be tweaked to work with other sensors or convert other data.
logfile_writer None Core, Messaging, Node, SDF, and Logfile Replays a PolySync logfile and uses the Logfile API to write a PolySync byte array message to a plog file. This example is a reference for writing to a plog file.
node_template None Core, Messaging, Node, Node Template, and SDF Shows the basic “node template” that all PolySync nodes use. This is a reference for understanding PolySync nodes and the different node states.
parrot_controller None Core, Messaging, Node, and SDF Demonstrates how to send hih level control commands to a vehicle in PolySync by forcing a Parrot to navigate around the screen via waypoints in the parrot_visualizer example. This example pairs with the parrot visualizer.
parrot_visualizer None Core, Messaging, and Node Simulates how a vehicle would respond to actuation commands in PolySync by having a parrot navigate via waypoints on screen. This example pairs with the parrot_controller example.
phidge_spatial_dynamic _driver_interface Phidget Spatial Accelerometer Core, Messaging, Node, Node Template, and SDF An example of the dyanmic driver interface, the official interface for any hardware device or sensor data to enter the PolySync system. In this case the interface is written for the Phidget Spatial and is a reference for dyanmic drivers.
publish_subscribe None Core, Messaging, Node, Node Template, and SDF Illustrates simple publish and subscribe functionallity in PolySync, the most common form of node to node communication in a PolySync system. This is a reference for publish subscribe functionality and communication in PolySync.
rnr_control None Core, Messaging, Node, SDF, and Record and Replay APIs A tool to command nodes to open and replay a specified logfile session. It also exposes a lot of the functionality of the Record and Replay API as a command line tool.
rnr_node None Core, Messaging, Node, Node Template, Logfile, SDF, and Record and Replay APIs A node that listens and responds to the ps_rnr_msg messages which command the node to use the Logfile API to facilitate synchronized record an replay across all nodes in the system. This is a reference if a node needs to log incoming messages to replay later.
serial_reader A Serial Port Core, Messaging, Node, Node Template, SDF, and Serial Creates and reads data through a serial connection. It is a reference for a node to listen to a device over a serial connection.
serial_writer A Serial Port Core, Messaging, Node, Node Template, SDF, and Serial Creates and writes data to a serial connection. It is a reference for a node that talks directly to a device over a serial connection.
sharedmem_image_data_viewer A video device Core, Messaging, SDF, Shared Memory, Video Uses OpenGL to enable a lightweight application for viewing video data. It renders the image data from a node publishing to the bus but uses the shared memory queue to transmit the incoming image sensor data.
single_transform None Core and Transform Demonstrates the PolySync Transform API by pushing a transform to the stack and showing the resulting transformation. This is a reference for handling stack transformations.
socket_reader None Core, Messaging, Node, Node Template, SDF, and Socket Shows UDP socket communication in PolySync by reading data from a UDP socket.
socket_writer None Core, Messaging, Node, Node Template, SDF, and Socket Shows UDP socket communication in PolySync by writing data to a UDP socket.
transform_stack None Core and Transform Performs multiple transformations on the same stack by pushing a new transformation on to the transform stack. This is a reference for handling multiple stack transformations.
user_data_model None Core, Messaging, Node, Node Template and SDF A reference for modifying and regenerating the PolySync data model using the provided pdm-gen tool.
video_encode_decode USB Webcam Core, SDF, and Video Uses the video API to have a node talk directly with the video device. It connects a USB webcam, encodes the sensor data, and then decodes the image stream. This is a reference for connecting to a video device without using the video-device driver provided by PolySync.
viewer_lite None Core Visualizes LiDAR, RADAR, and object data from multiple sources on the PolySync bus.

C++ API examples

The repo can be cloned here: https://github.com/PolySync/PolySync-Core-CPP-Examples.git

`$ git clone https://github.com/PolySync/PolySync-Core-CPP-Examples.git`

Learn how to build the C++ examples.

C++ Examples in the Repo

Example Hardware Dependencies API Description
CANReader Linuxcan Compatible Hardware (Kvaser Leaf Light) Node and CAN Performs a simple CAN read in the OK state. An example of when a node needs to listen to a CAN channel.
CANReaderAndPublisher Linuxcan Compatible Hardware (Kvaser Leaf Light) Node and CAN Performs a simple CAN read and publishes each CAN frame received to the PolySync bus. This is a reference for when a nodes needs to reed and publish data on a CAN channel.
CANWriter linuxcan compatible hardware (Kvaser Leaf Light) Node and CAN Performs a simple CAN write in the OK state. An example of when a node needs to write to a CAN channel.
CSVExporter None Node Writes the incoming data to a CSV file. A reference for writing data of a given message type to a CSV file.
DataGenerator None Node Populates and publishes sample data from a single node onto the PolySync bus. It generates object, RADAR, and LiDAR data.
Echo None Prints what messages are current on the bus from the command line.
GroundPlaneDetection None Node Is a perception agorithm that determines and defines a set of LiDAR points to define the ground plane of a simulation. This is a reference for perception algorithms and algorithms that use LiDAR data.
HelloWorld None Node Demonstrates the basics of connecting to the PolySync bus allowing the user to read and write data. This is a reference for basic read/write functionality of the PolySync bus.
HelloWorldPublisher None Node Is a basic publisher to the PolySync bus publishing a set of bytes that form “Hello World”.
HelloWorldSubscriber None Node Is a basic application that subscribes to high-level messages on the PolySync bus. It pairs with the HelloWorldPublisher example.
LogSessionExport None Core and Logfile Transfer Demonstrates how to use the PolySync Log Session Transfer API to export a recorded log session. It is a reference for exporting log session to be imported and replayed on other PolySync systems.
LogSessionImport None Core and Logfile Transfer Demonstrates how to import a log session to a new distributed system using the Log Session API.
LogfileIterator None Node and Logfile Iterates over a specified logfile plog file reading its contents. This application has access to the raw data.
LogfileQueueReader None Node and Logfile A node that replays a PolySync logfile using the message queue. You would use this if you wanted to filter or pre-process the sensor data before publishing it to the bus.
LogfileReader None Node and Logfile Opens and reads a PolySync logfile plog file for replay.
LogfileWriter None Node and Logfile Replays a PolySync logfile and uses the Logfile API to write a PolySync byte array message to a plog file. This example is a reference for writing to a plog file.
ParameterGetSet None Node and ParameterGetSet API Uses the ParameterGetSet API to update a specific parameter ID at runtime and then publishes and subscribes the ps_parameters_msg. This is an example of the logic used to filter for a specific node on the bus.
PathPlanner None Node Builds a basic path planner algorithm in PolySync applying a A* planner to a simulated search space. This is a reference for path planning in PolySync.
PolysyncLidarTranslator None Node A LiDAR message translator for messages coming from PolySync into ROS via the PolySync ROS bridge. This is a reference for translating messages into ROS and using the PolySync ROS bridge.
PublishSubscribe None Node Illustrates simple publish and subscribe functionallity in PolySync, the most common form of node to node communication in a PolySync system. This is a reference for publish subscribe functionality and communication in PolySync.
QtImageViewer A Video Device Node and Video Creates a GUI application using Qt to visualize PolySync image data. It uses a VideoProcessor Node that recieves image dat and packages it for rendering.
Record A Sensor or Video Device Node and RecordSession API A tool that expects the user to enter the record session ID and then allows the user to stop the recording. This is a reference for how to properly access the RecordSession API’s functionality
Replay None Node and ReplaySession API A tool that expects the user to enter the replay session ID and allows the user to stop the replay. This is a reference for how to properly access the ReplaySession API’s functionality
SampleApplication None Node A application node template. This is a reference for constructing the application node template.
SerialConfig Two Serial Ports Node and Serial This example configures a serial port using the Serial API and prints strings between two ports. A reference for configuring serial ports.
SerialReader A Serial Port Node and Serial Creates and reads data through a serial connection. It is a reference for a node to listen to a device over a serial connection.
SerialWriter A Serial Port Node and Serial Creates and writes data to a serial connection. It is a reference for a node that talks directly to a device over a serial connection.
SharedMemoryImageDataViewer A Video Device Node, Shared Memory, and Video Uses OpenGL to enable a lightweight application for viewing video data. It renders the image data from a node publishing to the bus but uses the shared memory queue to transmit the incoming image sensor data.
SingleTransform None Node and Transform Pushes a transform to the stack and shows the resulting transformation. This is a reference for handling stack transformations.
SocketReader None Node, Core, and Socket Shows UDP socket communication in PolySync by reading data from a UDP socket.
SocketWriter None Node, Core, and Socket Shows UDP socket communication in PolySync by writing data to a UDP socket.
TransformStack None Node and Transform Uses the Transform API to perform multiple transforms on the same stack by pushing a new transformation on to the transform stack. This is a reference for handling multiple stack transformations.
VideoDeviceViewer LiDAR, RADAR, or Video Device Video Visualizers LiDAR, RADAR, and object data from multiple sources on the PolySync bus.
VideoEncodeDecode USB Webcam Video Uses the Video API to have a node talk directly with the video device. It connects a USB webcam, encodes the sensor data, and then decodes the image stream. This is a reference for connecting to a video device without using the video-device driver provided by PolySync.