# xarm-developer/xarm-python-sdk architecture

> Architecture diagram of the GitHub repository xarm-developer/xarm-python-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xarm-developer/xarm-python-sdk
- Repository: https://github.com/xarm-developer/xarm-python-sdk

## Overview

xArm-Python-SDK is a Python client for controlling UFACTORY xArm robots and related peripherals. The principal workflow is that an application calls the public API, which delegates robot operations to the xArm control layer; commands then pass through the Uxbus protocol and communication transports to the robot, with reports and feedback handled by the control layer. The SDK also exposes accessory controls, Studio/Blockly tools, G-code and Modbus TCP capabilities. Relationships are based on the README and SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`xarm/x3/xarm.py`](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/xarm.py) (xArm interface), [`xarm/x3/base.py`](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/base.py) (Robot base), [`xarm/core/wrapper/uxbus_cmd.py`](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/wrapper/uxbus_cmd.py) (Uxbus commands), [`xarm/core/comm/socket_port.py`](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/comm/socket_port.py) (TCP transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public interfaces"]
  node_public_api["Public API<br/>[xarm_api.py]"]
  node_studio_api["Studio API<br/>[studio_api.py]"]
end

subgraph group_control["Robot control"]
  node_robot["xArm interface<br/>[xarm.py]"]
  node_base["Robot base<br/>[base.py]"]
  node_motion["Motion control<br/>[xarm.py]"]
  node_gpio["GPIO control<br/>[gpio.py]"]
  node_gripper["Grippers<br/>[gripper.py]"]
  node_force["Force sensor<br/>[ft_sensor.py]"]
  node_linear["Linear motor<br/>[linear_motor.py]"]
  node_servo["Servo control<br/>[servo.py]"]
  node_reports["Robot reports<br/>[report.py]"]
  node_codes["Status codes<br/>[code.py]"]
end

subgraph group_protocol["Protocol transport"]
  node_uxbus["Uxbus commands<br/>[uxbus_cmd.py]"]
  node_tcp["TCP transport<br/>[socket_port.py]"]
  node_serial["Serial transport<br/>[serial_port.py]"]
  node_config["Robot config<br/>[x_config.py]"]
  node_bytes["Byte conversion<br/>[bytes_data.py]"]
end

subgraph group_tools["Programs and peripherals"]
  node_blockly["Blockly conversion"]
  node_blockly_tool["Blockly tools<br/>[_blockly_tool.py]"]
  node_gcode["G-code client<br/>[gcode.py]"]
  node_modbus["Modbus TCP client<br/>[modbus_tcp.py]"]
  node_studio["Studio support<br/>[studio.py]"]
end

node_application(("Application"))

node_application -->|"calls"| node_public_api
node_public_api -->|"delegates"| node_robot
node_studio_api -->|"uses"| node_public_api
node_studio_api -->|"uses"| node_studio
node_robot -->|"inherits"| node_base
node_robot -->|"uses"| node_gpio
node_robot -->|"uses"| node_gripper
node_robot -->|"uses"| node_force
node_robot -->|"uses"| node_linear
node_robot -->|"uses"| node_servo
node_base -->|"uses"| node_uxbus
node_base -->|"configures"| node_tcp
node_base -->|"configures"| node_serial
node_base -->|"uses"| node_config
node_base -->|"uses"| node_reports
node_uxbus -->|"encodes"| node_bytes
node_uxbus -->|"uses"| node_config
node_tcp -->|"uses"| node_base
node_tcp -->|"uses"| node_config
node_blockly_tool -->|"uses"| node_blockly
node_robot -->|"uses"| node_blockly_tool
node_blockly -.->|"converts projects"| node_studio

click node_public_api "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/wrapper/xarm_api.py"
click node_studio_api "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/wrapper/studio_api.py"
click node_robot "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/xarm.py"
click node_base "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/base.py"
click node_motion "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/xarm.py"
click node_gpio "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/gpio.py"
click node_gripper "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/gripper.py"
click node_force "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/ft_sensor.py"
click node_linear "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/linear_motor.py"
click node_servo "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/servo.py"
click node_reports "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/report.py"
click node_codes "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/code.py"
click node_uxbus "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/wrapper/uxbus_cmd.py"
click node_tcp "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/comm/socket_port.py"
click node_serial "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/comm/serial_port.py"
click node_config "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/config/x_config.py"
click node_bytes "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/utils/bytes_data.py"
click node_blockly "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/tools/blockly/_blockly_handler.py"
click node_blockly_tool "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/tools/blockly/_blockly_tool.py"
click node_gcode "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/tools/gcode.py"
click node_modbus "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/tools/modbus_tcp.py"
click node_studio "https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/studio.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_public_api,node_studio_api toneBlue
class node_robot,node_base,node_motion,node_gpio,node_gripper,node_force,node_linear,node_servo,node_reports,node_codes toneAmber
class node_uxbus,node_tcp,node_serial,node_config,node_bytes toneMint
class node_blockly,node_blockly_tool,node_gcode,node_modbus,node_studio toneRose
class node_application toneIndigo
```

## Components

### Public interfaces

- [Public API](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/wrapper/xarm_api.py): `xarm/wrapper/xarm_api.py`
- [Studio API](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/wrapper/studio_api.py): `xarm/wrapper/studio_api.py`

### Robot control

- [xArm interface](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/xarm.py): `xarm/x3/xarm.py`
- [Robot base](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/base.py): `xarm/x3/base.py`
- [Motion control](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/xarm.py): `xarm/x3/xarm.py`
- [GPIO control](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/gpio.py): `xarm/x3/gpio.py`
- [Grippers](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/gripper.py): `xarm/x3/gripper.py`
- [Force sensor](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/ft_sensor.py): `xarm/x3/ft_sensor.py`
- [Linear motor](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/linear_motor.py): `xarm/x3/linear_motor.py`
- [Servo control](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/servo.py): `xarm/x3/servo.py`
- [Robot reports](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/report.py): `xarm/x3/report.py`
- [Status codes](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/code.py): `xarm/x3/code.py`

### Protocol transport

- [Uxbus commands](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/wrapper/uxbus_cmd.py): `xarm/core/wrapper/uxbus_cmd.py`
- [TCP transport](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/comm/socket_port.py): `xarm/core/comm/socket_port.py`
- [Serial transport](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/comm/serial_port.py): `xarm/core/comm/serial_port.py`
- [Robot config](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/config/x_config.py): `xarm/core/config/x_config.py`
- [Byte conversion](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/core/utils/bytes_data.py): `xarm/core/utils/bytes_data.py`

### Programs and peripherals

- [Blockly conversion](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/tools/blockly/_blockly_handler.py): `xarm/tools/blockly/_blockly_handler.py`
- [Blockly tools](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/tools/blockly/_blockly_tool.py): `xarm/tools/blockly/_blockly_tool.py`
- [G-code client](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/tools/gcode.py): `xarm/tools/gcode.py`
- [Modbus TCP client](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/tools/modbus_tcp.py): `xarm/tools/modbus_tcp.py`
- [Studio support](https://github.com/xarm-developer/xarm-python-sdk/blob/master/xarm/x3/studio.py): `xarm/x3/studio.py`

### Other components

- **Application**

## Connections

- Application → Public API: calls (evidence: `README.md`)
- Public API → xArm interface: delegates (evidence: `xarm/wrapper/xarm_api.py`)
- Studio API → Public API: uses (evidence: `xarm/wrapper/studio_api.py`)
- Studio API → Studio support: uses (evidence: `xarm/wrapper/studio_api.py`)
- xArm interface → Robot base: inherits (evidence: `xarm/x3/xarm.py`)
- xArm interface → GPIO control: uses (evidence: `xarm/x3/xarm.py`)
- xArm interface → Grippers: uses (evidence: `xarm/x3/xarm.py`)
- xArm interface → Force sensor: uses (evidence: `xarm/x3/xarm.py`)
- xArm interface → Linear motor: uses (evidence: `xarm/x3/xarm.py`)
- xArm interface → Servo control: uses (evidence: `xarm/x3/xarm.py`)
- Robot base → Uxbus commands: uses (evidence: `xarm/x3/base.py`)
- Robot base → TCP transport: configures (evidence: `xarm/x3/base.py`)
- Robot base → Serial transport: configures (evidence: `xarm/x3/base.py`)
- Robot base → Robot config: uses (evidence: `xarm/x3/base.py`)
- Robot base → Robot reports: uses (evidence: `xarm/x3/base.py`)
- Uxbus commands → Byte conversion: encodes (evidence: `xarm/core/wrapper/uxbus_cmd.py`)
- Uxbus commands → Robot config: uses (evidence: `xarm/core/wrapper/uxbus_cmd.py`)
- TCP transport → Robot base: uses (evidence: `xarm/core/comm/socket_port.py`)
- TCP transport → Robot config: uses (evidence: `xarm/core/comm/socket_port.py`)
- Blockly tools → Blockly conversion: uses (evidence: `xarm/tools/blockly/_blockly_tool.py`)
- xArm interface → Blockly tools: uses (evidence: `xarm/x3/xarm.py`)
- Blockly conversion → Studio support: converts projects
