Getting Started With PolySync Core

## Introduction PolySync is a platform consisting of a middleware and set of services that are common across autonomous driving applications. Take a look at the following diagram: ![Middleware](/wp-content/uploads/2016/06/basics-layers-diagram.png) PolySync separates the application layer from the underlying OS and hardware, making it more consistent to build and much more portable. ### Dive deeper : PolySync basics At the lowest level you can see the three types of inter-process communications (IPC) provided by PolySync: * Publisher/Subscriber * A type of communications architecture where a single node can broadcast messages to many listeners simultaneously, and where a single node can listen to many broadcasters simultaneously. * Get/Set * A type of communications architecture where applications can be queried for different parameters and will return their current values ("get"). In some cases, these values can be remotely changed ("set"). * Shared Memory * When nodes are interfacing with very high bandwidth data such as video frames, shared memory provides a queue that allows easy access for all other nodes on a single host computer. In addition to IPC, PolySync provides a variety of helpful services, including: * Hardware abstraction * Host abstraction * Time services * Coordinate frame transformation * Record and replay * Diagnostics * Analytics ![PS Functionality](/wp-content/uploads/2016/06/basics-MiddlewareLayer.png) ## This guide We have tuned this introduction to address software and robotics engineers who may have some experience already with ROS, but are looking to quickly get started using PolySync’s production-ready toolkit. We recommend that you follow the Get Started steps in order, as knowledge gained in earlier chapters will be used heavily in later chapters. ### Install PolySync #### Compatibility For development, most PolySync users stick with x86 processors running Ubuntu Linux 14.04, but it’s made to be fully embeddable. We support other systems─everything from Raspberry Pi to NVIDIA DrivePX─view the full list of supported architectures . #### 1. Download To begin, you can use either our GUI installer or manually install with our tarball download . For the purposes of this introduction, we’ll be using the GUI installer, but if you’d like to take a crack at the manual method, we recommend you first arm yourself with our dependency list. #### 2. Install After downloading the PolySync installer, open a terminal and navigate to the directory where it has been downloaded. Then run the following command. ```bash $ bash polysync-release-2.0-x86_64.bin ``` It can take up to 15 minutes for all installation and configuration steps to complete. ##### Install on distributed systems If you are working with a distributed system, then you can follow the Distributed Host Set Up article to prepare your system for running PolySync applications with multiple hosts. #### 3. Activate When installation completes, the installer will ask for an Activation ID. If you have already received a trial license, enter it (hyphens included). If not, please visit our [Request a Trial License](/articles/?p=1707) article to request one. Once you’ve received your ID, you can apply it post-installation with the following command: ```bash $ polysync-license-tool -a ACTIVATION-ID-GOES-HERE ``` #### 4. Upgrade To upgrade, just run a newer version of the installer. The installer will detect previous installations and settings and ask if you would like to backup the previous installation into the /opt directory. Before doing this, though, you should backup your current SDF and any applications you have developed that are located within the /usr/local/polysync/ directory. #### 5. Studio The **PolySync manager** manages the communication of messages between nodes on the bus . In this example, we’re going to use the manager to start the predefined nodes from the System Design File (SDF) using the following command: ```bash $ polysync-manager -n -w ``` The '-n' flag spawns all nodes that are defined and enabled in the SDF. The '-w' flag switches the system to "no hardware" mode, so that you can replay data. (For more information on PolySync manager, run `$ polysync-manager -h`.) PolySync Studio allows data being published to the PolySync bus to be visualized and debugged. It also provides a replay module that can play back sessions, which are simply collections of log files that have been recorded together. To open Studio, select PolySync Studio from the Application directory, or in the command line type: ```bash $ polysync-studio ``` Once Studio has loaded, you’ll see the plugin loader on the right hand of the screen. In this example, we’ll add new instances of the System Hierarchy and 3D View plugins to the workspace. These will allow you to view the runtime status of the nodes or (in this case) view data captured in the logfiles. #### 6. Check for errors Check the System Hierarchy window for nodes that are in an error state. If a yellow ! appears, click the icon at the bottom-right of the application window to bring up the Console. ![YELLOWEXCLAMATION](/wp-content/uploads/2016/07/replay1.png) In this example, the System Hierarchy plugin shows that the SDF has defined three nodes. Each one is associated with a particular sensor. ![SDFNODES](/wp-content/uploads/2016/07/replay2.png) #### 7. Replay module To replay a logfile session, select the replay tab in the upper right corner of the Studio window. In the box below the player, a list of pre-loaded sessions should be visible. When you double-click on Session 1000, the play button should change to black after moment, indicating that all nodes are synchronized and playback can begin. When you press play, you should see the logfile data show up in the 3D View plugin. ![3DPLUGVIEW](/wp-content/uploads/2016/07/replay3.png) ### Conclusion Congratulations! You have now successfully downloaded and installed PolySync, and worked through opening Studio and replaying your data.