Skip to main content

Overview

The public 2.recording.py example uses TopicRecorder to save WUJI Glove streams to an MCAP file.
This page uses Python. For C SDK recording, see Recording Examples.

Prerequisites

Example Configuration

Integration Steps

The following snippets run inside async def main() in the public example. See the example file for imports and the complete control flow.

Connect the Device

The example calls manager.scan(), filters for DeviceType.WujiGlove, and connects to the first glove by serial number. If no device or glove is found, it prints a message and exits.

Register the Channels

Create a recorder and register three device streams:

Start Recording

Create the output directory, generate a timestamped filename, and start recording:

Stop and Clean Up

After 10 seconds, call handle.stop(). If the task is cancelled, asyncio.shield() protects the stop task, and the example waits for it to finish:
The outer finally block calls manager.disconnect_all() to disconnect the device.

Running It

Run the following command from the root of the public wuji-sdk repository:
The program prints the discovered devices, the connected glove’s serial number, and the output path. When recording ends, the Done line shows these results: Open the MCAP file with Foxglove Studio or inspect it with mcap info.