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.
Stream data from your device
Section titled “Stream data from your device”- Connect the device and make sure it is sending data (over USB, or over Wi-Fi after following the Wi-Fi setup guide).
- Start the SDK driver with the RGMP v2 formatter enabled, as described
here:
Terminal window rkk_sdk_driver -ef 4 --pipeline_formatter rgmp_v2 - In another terminal, navigate to the
$ROKOKO_SDK_HOME/examples/pythonfolder 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.
Reading the output
Section titled “Reading the output”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 valuesBecause 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:
python3 rgmp_stream.py | cut -f1,8By 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.
python3 rgmp_stream.py --sep ,Filtering the streams
Section titled “Filtering the streams”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 thismeasure_type(e.g.POSITION,TRANSFORM,ORIENTATION).--target-frame FRAME— only streams for thistarget_frame(e.g.pelvis).
For example, to watch only the pelvis position:
python3 rgmp_stream.py --measure-type POSITION --target-frame pelvisPress Ctrl+C to stop streaming. The script prints a status line and closes the
socket cleanly.
Next steps
Section titled “Next steps”- Browse the
rgmp_stream.pyexample for the full, annotated source. - Read the RGMP v2 specification to understand the wire format.
- Review the SDK API Overview.