Skip to main content

Overview

The Wuji Hand 2 keeps a log ring buffer in flash. export_flash_logs() pulls the whole ring, decodes it frame by frame, and writes a JSONL file with one log entry per line. When something goes wrong on the device, this is the primary evidence. It records events from the firmware’s point of view, which sits closer to the fault than host-side SDK logs. Matching examples: examples/python/wuji_hand_2/5.export_flash_logs.py and examples/c/wuji_hand_2/5_export_flash_logs.c. For diagnostic and logging API definitions, see Diagnostics and Logs. This page covers only how to run it and what the measurements show. This example only reads. It doesn’t enable the motors, and the fingers don’t move.

Prerequisites

Hardware

Software

Data Flow

Every call exports everything and writes a new file. There’s no API to ask how many entries exist first, and no incremental export.

Where Output Goes

out_dir defaults to None, writing to the SDK’s default directory ~/.wuji/logs alongside the SDK’s own logs, with a flash_ prefix on the filename:
Pass out_dir to write elsewhere.

Fields per Line

Runtime Handling

Integration Steps

The return value is a dict with exactly two keys, path and frames.

Running It

Measurements

On a right-hand Wuji Hand 2:
What the export contained: Most of it is periodic status lines from sboard_app shaped like [B2] T:25 R:20 g:0 bc:0/0 ..., plus node heartbeats such as nodes 4/5: [1:hb=0 2:hb=0 ...]. When investigating, filter by level for Warn and above first, then narrow by target to a module.

Adapting It

Filter for What You Care About

Each JSONL line stands alone, so jq filters directly:

Export to a Specific Directory

Pass the out_dir argument. The default lands in ~/.wuji/logs mixed in with the SDK’s own logs, distinguished by the flash_ prefix.

How This Relates to Host-Side SDK Logs

The two have different vantage points. Flash logs are the firmware’s view, recording the bus, node heartbeats, and server state. SDK logs sit in the same directory and record host-side connect, subscribe, and publish activity. For connection problems, compare timestamps across both.

Don’t Call It in a Real-Time Loop

A full export pulls the entire ring buffer, measured at about 3 seconds for a thousand-odd entries. This is an investigation tool, not a monitoring mechanism. For continuous monitoring, subscribe to joint_diagnostics.