Record Logfiles

PolySync Core is able to record incoming sensor data, and allows you to replay the data on any other system. Using Studio or command line tools, you can command nodes to start and stop the recording of incoming data.

Both methods use the same underlying logic to record data: the application populates a ps_rnr_msg with the desired state and publishes the message to the bus, which active nodes receive and respond to.

1. Recording data with Studio

1.1 Starting the runtime

Before sensor data can be recorded, runtime nodes must be running in the hardware state.

To command nodes into the hardware state, press Studio’s Icon button.

For more detailed instructions, see the Runtime section for an article detailing how to start sensor and hardware nodes in hardware mode.

1.2 Start recording data

To begin recording data, press the Icon button.

The record module will name the logfile session based on the UTC timestamp of the moment the record button is pressed.

If you cannot see the Icon button, then the runtime nodes are note operating in hardware state, and you should check Studio’s system state which is launched from the icon.

Studio landing page - system state icon

1.3 Command active nodes to stop recording data

When you’ve finished recording your data or scenario, press the Icon button.

2. Change the Record and Replay Directory

Each host ECU in a PolySync Core runtime has a unified directory where sensor data is written to.

This is defined in the system SDF using the SDF Configurator.

$ polysync-core-sdf-configurator

Update the Record and Replay Directory on each host to change the location where logfiles are written to. By default logfiles are located in $PSYNC_USER_HOME/rnr_logs/.

Each node in the runtime records data asychronously to a PolySync plog logfile. A collection of plog’s is a logfile session.

3. Nodes that support record and replay

Custom nodes don’t natively record and replay data. They must use PolySync APIs to manage logfile data, for example the PolySync-provided nodes, or the rnr_node C example application.

PolySync-provided nodes implement file reading and writing routines using the PolySync Logfile API. The nodes also need to listen for the ps_rnr_msg, which uses the Record & Replay API to instruct nodes regarding what files they should open, and when to start/stop recording and replaying data.

Applications like Studio’s replay module implement the Record & Replay API to instruct nodes which directory to record data to, and at what time to start writing data to the disk (now, or in the near future).

4. Next steps

The logfile session is now available in Studio’s logfile management area which is opened with the icon.

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.