Skip to main content

Overview

Hand model and tactile calibration data belongs to the current SDK user. When several people share one glove on the same computer, create a separate user for each person to keep calibration data separate. User information is stored locally and is not uploaded. The current user is written to a configuration file shared by Python and C, so a switch takes effect in other processes immediately. Confirm the current user before calibration. This page covers user creation, switching, deletion, and data transfer. Matching examples: examples/python/wuji_glove/4.user.py and examples/c/wuji_glove/3_user_management.c. For API and field definitions, see SDK User Management and User Data Import and Export.

Prerequisites

Hardware

User management reads and writes local data and doesn’t need a glove.

Software

Data Flow

Local Storage Layout

The SDK uses ~/.wuji/sdk/ for the following data:
Example registry.toml:
The default user’s user_id is an empty string, not "default" or None. current_user_id is stored in this file, so user switching persists.

API Reference

The user management interfaces are: Python and C provide equivalent user management capabilities. Use the export, preview, and import interfaces to move calibration data between computers. On the Python side, the user dict holds user_id, display_name, description, is_default, created_at, updated_at, and external_id. The C WujiUserInfo struct uses the same field names. The SDK allocates strings in WujiUserInfo output values. Free a single structure with wuji_user_info_free(&user) and an array with wuji_user_info_array_free(users, len). Do not mix these functions. Besides display_name, description, and external_id, WujiUserUpdate carries the booleans clear_description and clear_external_id for setting a field to empty. Passing NULL means “leave it alone,” not “clear it.”

Integration Steps

Confirm the current user, select or create a user, then check the switch result. User operations don’t require a connected device.

1. Read the Current User

Read the current user to confirm who will own subsequent calibration data.

2. Select or Create a User

Find users by display name. Reuse an existing user, or create one if none matches. Python’s find_user_by_display_name and C’s switch_or_create_user and ExampleArgs come from Python example and C example. They aren’t SDK APIs. Multiple users with the same name cause an error. Resolve duplicates before switching.
The C helper calls wuji_list_users, then wuji_create_user or wuji_update_user as needed, followed by wuji_switch_user. It frees the query list and temporary user information and returns the selected current user.

3. Switch and Confirm

Python switches by user_id. C has already switched in the previous step. Check the returned user information before calibration. The selected user persists and is used by subsequent processes.

4. Release Resources

Python manages user dictionaries at runtime. In C, free user information and shut down the SDK when the program ends. Freeing query results doesn’t delete users or calibration data.

Run the Examples

Measured output from the C side’s --list:
When you create a user, the previous and current blocks differ:
Both sides print identical formats, which the examples align deliberately. The * marks the current user. These are real results from SDK v2026.8.31 with no device connected. Every user created during verification has been deleted, and the current user is back to what it was.

Behavior and Error Handling

The following behavior applies to the user management interfaces.

User Names Must Be Unique

The SDK guarantees unique display_name values. The duplicate-match branch in the example is not reached:
Callers don’t need an additional branch for duplicate results. Callers still need to handle a name collision during creation. Concurrent creates can race, so catch WujiException.

Deleting the Current User

After deletion, the SDK switches to the default user: The operation doesn’t leave a dangling current-user pointer. It also deletes that user’s calibration data, so confirm before deleting.

The Default User Can’t Be Deleted

A Nonexistent user_id Raises an Error

The SDK doesn’t switch to the default user automatically.

Switching Takes Effect Across Processes and Languages

For example:
  1. The C program runs ./3_user_management --default-user, switching to Default
  2. A brand-new Python process reads current_user()
The result is Default with a user_id of ''. Going the other way, a user created by the C program’s --user-name CDocTest shows up in Python’s list_users() immediately, with non-ASCII text in description intact:
Both interfaces read and write the same registry.toml and don’t maintain separate caches.

Export Requires Calibration Data

Calling export_user_data for a user without calibration data:
Both arguments in export_user_data(user_id, out_path) are required.

Error Handling Quick Reference

Command-line tools can catch WujiException and exit with a non-zero status. Display the exception message without printing the full traceback.

Usage Recommendations

Confirm the User Before Calibrating

This is the whole reason for this page. Calibration output lands under the current user, so the wrong user overwrites someone else’s data, silently. Add one line at the top of your calibration script:

Move Calibration Results to Another Machine

export_user_data packs the bundle, preview_user_data shows you what’s inside on the target machine, and import_user_data brings it in once you’re satisfied. Importing recreates the user as needed, so you don’t have to create a matching user by hand first. The user dict carries an external_id field that neither example uses. When you connect your own account system, store your external primary key there instead of matching on display_name.

Keep Scripts Non-Interactive

Both examples are one-shot command-line tools, which suits dropping them into the shell script around your calibration flow. --list exits 0 on success and 1 on failure, so you can branch on that.