Skip to content
Get SDK Access

Streaming data from your Rokoko device

This guide will show you how to stream live motion data off your Rokoko device using the RGMP v2 protocol. The rgmp_stream.py example connects to the driver, reads the stream definition, and prints each value as a delimited row you can pipe into other tools.

Normally this data is consumed inside an application that links the SDK, but running the example script is the quickest way to confirm data is flowing and to inspect what the device is sending.

  1. Connect the device and make sure it is sending data (over USB, or over Wi-Fi after following the Wi-Fi setup guide).
  2. Start the SDK driver with the RGMP v2 formatter enabled, as described here:
    Terminal window
    rkk_sdk_driver -ef 4 --pipeline_formatter rgmp_v2
  3. In another terminal, navigate to the $ROKOKO_SDK_HOME/examples/python folder and run the following command:
    Terminal window
    python3 rgmp_stream.py --host 127.0.0.1 --port 12276

This script will connect to the driver and start printing one row per stream value as data arrives. If it cannot connect, it prints an error message and terminates. The script accepts various arguments on the command line; run it with the --help argument to see all available options.

The --host and --port arguments point the script at the RGMP server. The defaults (127.0.0.1 and 12276) match the driver running on the same machine, so you can usually omit them. To read from a driver on another machine, pass its address explicitly.

Status and banner lines are written to stderr, each prefixed with #, so they stay out of the way. The actual data goes to stdout as a #-prefixed header line followed by one row per matched value:

timestamp_us group target_frame reference_frame measure_type custom_label data_type values

Because the status lines go to stderr and the data to stdout, you can pipe the data straight into standard tools without the banners getting in the way — for example, to grab just the timestamp and values columns:

Terminal window
python3 rgmp_stream.py | cut -f1,8

By default columns are separated by a TAB. Use --separator/--sep to choose another delimiter; it accepts escapes like \t, ,, or |. The values column can hold several numbers, so it uses its own inner separator (a comma, or a semicolon when the column separator is already a comma) to stay a single field.

Terminal window
python3 rgmp_stream.py --sep ,

A stream definition usually describes far more data than you want to watch. Three optional filters narrow it down, and they combine — a stream must match all the filters you give:

  • --group-name NAME — only streams from this group (exact match).
  • --measure-type TYPE — only streams with this measure_type (e.g. POSITION, TRANSFORM, ORIENTATION).
  • --target-frame FRAME — only streams for this target_frame (e.g. pelvis).

For example, to watch only the pelvis position:

Terminal window
python3 rgmp_stream.py --measure-type POSITION --target-frame pelvis

Press Ctrl+C to stop streaming. The script prints a status line and closes the socket cleanly.