Running Inference on the Client

Running Inference on the Client

Update the Client Version (both robot types)

The desktop and ex001 robot types work the same way: desktop/ex001_client (desktop/ex001-client_robot_client-1).

The latest client version for API inference and bus2610 is v00.13.11. Make sure the client is on this version.

How to change it:

  1. Open a browser (the latest Chrome is recommended) and go to robot IP:9000 to reach the container manager (entering only the IP opens the WebUI).

    Username: admin, password: xsquarerobot

  2. Click local to enter Portainer:

    Portainer home page, click local

  3. Click Stacks on the left, find desktop_client/ex001_client, and click it.

    Stacks list

    Version number on the image line in the stack editor

    Alternatively, you can look up the container directly:

    Version number in the Image column of the Containers list

If the version is v00.13.11 or later, you can continue (do not use v00.13.09 / v00.13.10 on Orin machines; the cameras do not work in those two arm64 images).

For inference parameters, see the "Client Inference Configuration Parameters" section of this tutorial.

Inference on TeleTwin Desktop

Enter the container

There are two ways to enter the container:

  1. Open a terminal from the web UI: find the client container as described above.

    Console entry in the container list

    Container console page, click Connect

    Click connect to open the terminal.

  2. ssh into the robot from your own computer, then enter the container.

    ssh xr@ip. Ask the relevant staff for the password (if you don't have it, that's fine: entering the container from the web UI works exactly the same way).

    ssh login to the robot

    Enter the container with:

    docker exec -it desktop_client-robot_client-1 bash

    Note: on some machines the container may be named desktop-robot_client-1. Check the container name in the web UI.

Start inference with the script

The script for the desktop robot type is:

/opt/xr/bot/x2robot_client/share/x2robot_client/scripts/start_desktop.sh

Viewing start_desktop.sh inside the container

You can then start inference. Examples follow.

Synchronous mode

bash /opt/xr/bot/x2robot_client/share/x2robot_client/scripts/start_desktop.sh \
  --attach \
  --model-address <MODEL_ADDRESS> \
  --infer-type sync \
  --instruction "put the spoon into the bowl" \
  --embodiment teletwin_desktop/gripper-g \
  --infer-params '{"action_horizon":32,"control_dt":0.005,"interpolate_multiplier":7,"async_params":{"algorithm":"sync","api_key":"<API_KEY>"}}' \
  --home-on-stop

After you stop with Ctrl + C, the robot returns to its home position automatically (because of --home-on-stop).

If you press Ctrl + C more than once, or the robot does not return home for another reason, see the homing commands in the appendix.

RTC inference mode

bash /opt/xr/bot/x2robot_client/share/x2robot_client/scripts/start_desktop.sh \
  --attach \
  --model-address <MODEL_ADDRESS> \
  --infer-type async \
  --instruction "put the spoon into the bowl" \
  --embodiment teletwin_desktop/gripper-g \
  --camera-resize-width 448 \
  --infer-params '{"action_horizon":32,"control_dt":0.005,"interpolate_multiplier":8,"async_params":{"algorithm":"training_time_rtc","api_key":"<API_KEY>"}}' \
  --home-on-stop

Analyze inference

One way to debug is with the container logs. Still in the container view, just click it.

Logs entry in the container list

Container logs page

Common Desktop commands

  1. Enable the arm controllers (rarely needed)

    source /opt/xr/bot/setup.bash
    
    ros2 service call /realtime_controller_manager/hardware_enabled \
      protocol/srv/HardwareEnabled "{enabled: true}"
  2. Manually home the Desktop (mode 11 → 1)

    source /opt/xr/bot/setup.bash
    
    ros2 service call /realtime_controller_manager/switch_controller_mode \
      protocol/srv/SwitchControllerMode "{mode: 11}"
    
    ros2 service call /realtime_controller_manager/switch_controller_mode \
      protocol/srv/SwitchControllerMode "{mode: 1}"

Inference on Quanta_X1_Pro

After ssh into EX001, entering the client container

The scripts here are for robot type quanta_x1_pro/gripper-g (EX001 with G gripper).

Script inference

Synchronous

bash /opt/xr/bot/x2robot_client/share/x2robot_client/scripts/start_ex001.sh \
  --attach \
  --model-address <MODEL_ADDRESS> \
  --infer-type sync \
  --instruction "put the spoon into the bowl" \
  --embodiment quanta_x1_pro/gripper-g \
  --infer-params '{"action_horizon":32,"control_dt":0.005,"interpolate_multiplier":7,"async_params":{"algorithm":"sync","api_key":"<API_KEY>"}}' \
  --home-on-stop

Training-time RTC inference mode

bash /opt/xr/bot/x2robot_client/share/x2robot_client/scripts/start_ex001.sh \
  --attach \
  --model-address <MODEL_ADDRESS> \
  --infer-type async \
  --instruction "put the spoon into the bowl" \
  --embodiment quanta_x1_pro/gripper-g \
  --camera-resize-width 448 \
  --infer-params '{"action_horizon":32,"control_dt":0.005,"interpolate_multiplier":8,"async_params":{"algorithm":"training_time_rtc","api_key":"<API_KEY>"}}' \
  --home-on-stop

Parameter meanings

Parameters used in both modes (when the command includes --embodiment, public_v2 is enabled automatically, and api_schema, image_wire_format=jpeg, use_history=true, and the RTC defaults are filled in for you; you don't need to write them)

ParameterMeaning
action_horizon: 32Each inference returns 32 action steps; this is the model's step count
control_dt: 0.005Control period of 5 ms (200 Hz); the dispatcher sends commands to the arms at this rate
interpolate_multiplierHow many control periods each model action step is interpolated into. Smaller values make motion faster. Defaults: sync 7, RTC 8 (about 35–40 ms per model step, close to the training rhythm). Participants can change it as needed
api_schema: public_v2Use the Wall-X form-2 public interface
algorithmChooses the client execution path: training_time_rtc is async RTC, sync is synchronous
embodiment: quanta_x1_pro/gripper-gTells the server the robot model and gripper type (G gripper); the server picks the normalization and action dimensions from it
image_wire_format: jpegImages are sent as raw JPEG bytes, not converted to base64, so less data is transferred
use_history: trueThe server keeps past observations within the same session and uses history frames for inference
api_keyPut in the Authorization: Bearer header during the WebSocket handshake, for authentication

Parameters used only in async mode

ParameterMeaning
camera_resize_width: 448Images wider than 448 are scaled down proportionally to 448 before sending. Synchronous mode has no such parameter and sends the original images
execute_horizon: 6When the current chunk reaches its 6th step, the next chunk is requested, so chunks overlap
max_inference_delay: 4Inference delay may take up to 4 model action steps. During that time the arms keep executing the old actions, and the new actions are aligned to the prefix of the old ones. The adaptive controller internally caps it at 4
initial_delay_estimate: 4Before any delay has been measured, the first inference assumes a delay of 4 steps; measured values are used after that
auto_interpolate_by_latency: trueTurns on adaptive RTC: the interpolation multiplier M is adjusted automatically from the measured end-to-end latency. With higher latency, motion slows down to cover network and inference time
hil_min_interpolate_multiplier: 8Lower bound of M when adapting. The fastest the arms move is 40 ms per step
sync_fallback_interpolate_multiplier: 8When latency is too high and M has reached its upper bound, execution falls back to synchronous automatically; this is the M used after the fallback

Parameters not written in async mode that use default values

  • hil_max_interpolate_multiplier: default 16, the upper bound of M.
  • fallback_to_sync_on_max_interpolate: default true, meaning fallback to synchronous is allowed once M reaches the upper bound.
  • sync_fallback_horizon: default 16, meaning after falling back to synchronous, each chunk executes only 16 steps.
  • auto_jpeg_quality_by_latency: on by default when camera_jpeg_quality is not set. JPEG quality is 85 on a fast network and 75 on a slow one.
  • interpolation_mode: default linear. Adaptive RTC only works in linear mode.

How synchronous mode behaves

Each request gets a chunk of 32 action steps. The next chunk is requested only after the current one finishes, so there is a pause of one inference time in between. There is no RTC overlap and no adaptive speed control.

Script inference with arms only (with return_body)

Synchronous

bash /opt/xr/bot/x2robot_client/share/x2robot_client/scripts/start_ex001.sh \
  --attach \
  --model-address <MODEL_ADDRESS> \
  --infer-type sync \
  --instruction "put the spoon into the bowl" \
  --embodiment quanta_x1_pro/gripper-g \
  --return-body '{"car_pose":false,"head_pose":false,"lift":false}' \
  --infer-params '{"action_horizon":32,"control_dt":0.005,"interpolate_multiplier":7,"async_params":{"algorithm":"sync","api_key":"<API_KEY>"}}' \
  --home-on-stop

Training-time RTC

bash /opt/xr/bot/x2robot_client/share/x2robot_client/scripts/start_ex001.sh \
  --attach \
  --model-address <MODEL_ADDRESS> \
  --infer-type async \
  --instruction "put the spoon into the bowl" \
  --embodiment quanta_x1_pro/gripper-g \
  --camera-resize-width 448 \
  --return-body '{"car_pose":false,"head_pose":false,"lift":false}' \
  --infer-params '{"action_horizon":32,"control_dt":0.005,"interpolate_multiplier":8,"async_params":{"algorithm":"training_time_rtc","api_key":"<API_KEY>"}}' \
  --home-on-stop

return_body tells the server not to return actions for the chassis (car_pose), head (head_pose), and lift (lift). When the server does not return them, the client does not drive these three parts, and they stay where they were when inference started. Only the arms and grippers move.

Appendix 1: Common Quanta_X1_Pro Commands

  1. Enable the hardware (rarely needed)

    source /opt/xr/bot/setup.bash
    
    ros2 service call /realtime_controller_manager/hardware_enabled \
      protocol/srv/HardwareEnabled "{enabled: true}"
  2. Home the Quanta_X1_Pro arms only (mode 9 → 1)

    source /opt/xr/bot/setup.bash
    
    ros2 service call /realtime_controller_manager/switch_controller_mode \
      protocol/srv/SwitchControllerMode "{mode: 9}"
    
    ros2 service call /realtime_controller_manager/switch_controller_mode \
      protocol/srv/SwitchControllerMode "{mode: 1}"
  3. Adjust the lift (waist) height

    source /opt/xr/bot/setup.bash
    
    # Enable the absolute position controller
    ros2 control switch_controllers \
      --deactivate lift_relative_movej_controller lift_joint_trajectory_controller \
      --activate lift_absolute_movej_controller \
      --best-effort
    
    # Then send the target position (0.40 m in this example)
    ros2 topic pub --once /lift_position_controller/commands \
      std_msgs/msg/Float64MultiArray "{data: [0.40]}"

    Check the current lift height:

    source /opt/xr/bot/setup.bash
    
    ros2 topic echo --once /lift/joint_states
  4. Home the head (we recommend not moving the head)

    source /opt/xr/bot/setup.bash
    
    ros2 service call /hal/head/pan_tilt_control \
      protocol/srv/HeadPanTiltControl \
      "{yaw_position: 0.0, yaw_velocity: 0.1, pitch_position: 0.0, pitch_velocity: 0.1}"

Appendix 2: Update the Client Version

To update only the client:

Container details page, click Duplicate/Edit

Change the version below to v00.13.11 or later:

Enter the new version in the Image field

Then update the start command. The start command is:

'bash' '-i' '-c' 'source /opt/xr/bot/setup.bash && ros2 launch x2robot_infer infer_with_dispatcher.launch.py'

Overriding Command under Advanced container settings

When you're done, click Deploy the container.

On this page