Access Data from the Bus

This article was written for version 2.3.0 of Core. Click here for the most recent version of the help center.

This article demonstrates how to access the same data from the Core bus using three applications.

  • Studio’s Trace plugin
  • Echo command line tool
  • Generated C++ node

Generate sample data

This step may be skipped if data is already being published to the bus by one or more nodes.

Start the C data-generation application to begin publishing sample data to the bus.

$ git clone https://github.com/PolySync/PolySync-Core-C-Examples
$ cd PolySync-C-Examples/data-generator
$ make
$ ./bin/polysync-data-generator-c

Studio Trace

Trace extracts the incoming message buffer into an easy to read table.

  1. Start Studio
  2. Open the Trace plugin
  3. From the control panel on the left-side, select message type from the drop-down menu, for example ps_objects_msg
    • The drop down menu contains messages that were seen on the bus at least once
  4. Click “Start Trace”
    • Using the control panel you can select/deselect the message fields you want the Trace plugin to print

Echo C++ Example

Echo is able to subscribe to messages from the bus and print filtered data to the terminal.

$ git clone https://github.com/PolySync/PolySync-Core-CPP-Examples
$ cd PolySync-CPP-Examples/Echo
$ mkdir build && cd build
$ cmake .. && make
$ ./polysync-echo -f ps_objects_msg

Echo is also able to print the incoming data to a CSV file. Pass the -h help flag to learn more.

Node generator

The node generator is a great tool to get you developing custom nodes in PolySync Core quickly. It generates the C++ code for a node that subscribes to the specified message types.

$ polysync-generate node -s ps_objects_msg
$ cd MyNode
$ mkdir build && cd build
$ cmake .. && make
$ ./MyNode