Record Logfiles (Command Line)

1. Commanding record on the command line

There are two different command line tools that allow you to command active runtime nodes to start and stop the recording of data. There’s an example written in C and another written in C++.

This section will show you how to build, run, and use the C rnr_control example.

The example can be cloned from the C repo and built using make:

$ git clone git@github.com:PolySync/PolySync-Core-C-Examples.git
$ cd PolySync-Core-C-Examples/rnr_control
$ sudo apt-get install libglib2.0-dev  # this is required for this example to build, documented in the examples README.md file
$ make

The binary is named polysync-rnr-control-c.

1.1 Starting nodes in hardware mode

Before you can record data on the system, nodes must be running in the hardware mode. See the Runtime section for an article detailing how to start sensor and hardware nodes in hardware mode.

1.2 Commanding active nodes to record data

Before nodes are commanded to record data, it’s best to check the system state to ensure nodes are in a known-good state. Active nodes can be seen in Studio’s system state module.

The polysync-rnr-control-c application uses the -t flag to indicate the desination for the logged data, referred to as a logfile session. The logfile session will contain one plog file for each active sensor at the time of recording.

The -w flag tells indicates we want nodes to operate in record mode.

To begin recording data to session 1001, use the command:

$ polysync-rnr-control-c -w -t 1001

It’s important to note that the rnr_control application has no knowledge of the nodes on the PolySync bus. It’s simply packaging and publishing a ps_rnr_msg that active nodes subscribe and react to.

1.3 Commanding active nodes to stop recording data

To command nodes to stop recording data, pass the -q flag. At any time, issue the following command to end the logfile session:

$ polysync-rnr-control-c -q

Nodes will continue to parse sensor data, but they will stop recording and writing data to the logfile session.

Next steps

The logfile session is written to $PSYNC_USER_HOME/rnr_logs/1001, and can also be seen in Studio’s logfile management area.

The logfile session can be replayed on the local system or it can be exported from Studio, which allows you to import and replay your data on any other PolySync system.