# How to control a Doosan robot from Python using the API-DRFL wrapper

**URL:** <https://www.robotexchange.io/t/how-to-control-a-doosan-robot-from-python-using-the-api-drfl-wrapper/4675>\
**Category:** 💡 How-to\
**Tags:** Python, PC, Doosan-robot\
**Created:** [September 2, 2026, 12:16am UTC](https://www.robotexchange.io/t/how-to-control-a-doosan-robot-from-python-using-the-api-drfl-wrapper/4675 "2026-09-02T00:16:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thijs](https://www.robotexchange.io/user_avatar/www.robotexchange.io/thijs/32/4_2.png) [@thijs](https://www.robotexchange.io/u/thijs)\
**Post date:** [September 2, 2026, 12:16am UTC](https://www.robotexchange.io/t/how-to-control-a-doosan-robot-from-python-using-the-api-drfl-wrapper/4675/1 "2026-09-02T00:16:05Z")

</div>

_Based on contributions by Wouter.v.Velzen._

Doosan officially supports three ways to program their robots: DRL (via DRL/DART Studio, Windows only), ROS2 (Linux only), and the C++ API-DRFL (Linux and Windows, but C++). If you want one cross-platform Python program — instead of juggling a DRL script and a separate PC script over a socket — you can use a community Python wrapper that exposes the C++ API-DRFL as Python functions.

> ⚠ This approach bypasses DRL entirely, so the “DRL only has Python 3.2” limitation from [How to connect a Doosan robot to a PC over a TCP socket (DRL Studio and Python)](https://www.robotexchange.io/t/how-to-connect-a-doosan-robot-to-a-pc-over-a-tcp-socket-drl-studio-and-python/4673) doesn’t apply here — your control script runs as normal, modern Python on the PC, with full access to `pip` packages (OpenCV, NumPy, etc.) in the same program that talks to the robot.

## What you need

- A Doosan robot and control box. This wrapper has only been tested against **control box version 2** ; version 3 should work in theory but needs a one-line change (see [Troubleshooting](#troubleshooting)).
- Linux: Ubuntu (an LTS release) — other distros ship different library versions and the build will fail. If you’re not on Ubuntu LTS, run an Ubuntu environment via Docker/Podman with [Toolbox](https://docs.fedoraproject.org/en-US/atomic-desktops/toolbox/), or a VM.
- Windows: the C++ Visual Studio 2017 (or newer) runtime. ⚠ Windows builds currently fail to compile (see [Troubleshooting](#troubleshooting)) — running [Ubuntu via WSL](https://ubuntu.com/desktop/wsl) is the current workaround.
- Python 3, `git`, and the [API-DRFL-Wrapper](https://github.com/wouter1602/API-DRFL-Wrapper) repository (which pulls in the official [API-DRFL](https://github.com/DoosanRobotics/API-DRFL) as a submodule).

## Steps

### 1. Clone the wrapper

```bash
git clone --recurse-submodules https://github.com/wouter1602/API-DRFL-Wrapper.git
cd API-DRFL-Wrapper

```

### 2. Linux (Ubuntu) setup

Create and activate a virtual environment — this is required, since the build has nowhere else to put the compiled Python library:

```bash
python3 -m venv .venv
source .venv/bin/activate

```

Install the required packages:

```bash
pip install -r ./requirements.txt
sudo apt install libpoco-dev

```

Compile the library (this can take a while, depending on your machine):

```bash
python3 ./install.py

```

Run the example script to verify everything works — it should move the robot slightly:

```bash
python3 ./examples/minimal_motion_sample_async.py

```

Before running it, edit the IP address and other settings at the top of the example to match your robot:

```python
IP_ADDRESS = "127.0.0.1" # <- IP of your Doosan control box
PORT = 12345

SPEED = 5.0 # deg/s
ACCELERATION = 5.0 # deg/s^2
MOVE_TIMEOUT = 10.0 # seconds
POLL_INTERVAL = 0.05 # seconds (50 ms polling rate)

VIRTUAL = False # set True to simulate the movement instead of moving the real robot

```

### 3. Windows setup (currently broken — see below)

```bash
python -m venv .venv
.venv\Scripts\Activate.ps1

```

> If PowerShell refuses to run the activation script, see [this fix](https://stackoverflow.com/questions/18713086/virtualenv-wont-activate-on-windows).

Install the [Visual Studio C++ runtime 2017 or newer](https://visualstudio.microsoft.com/), then install the Python dependencies and compile:

```bash
pip install -r ./requirements.txt
python3 ./install.py

```

The build currently fails during stub generation because of a library import issue. Windows users should use Ubuntu via WSL (step 2) until this is fixed.

### 4. Use the library

The wrapper’s functions and objects mirror the official C++ API-DRFL 1:1, so the [Doosan C++ API-DRFL documentation](https://doosanrobotics.github.io/doosan-robotics-api-manual/GL013303/) applies directly — just call the same names from Python.

## Why use this over DRL or ROS2

- **One program.** Robot control and everything else your PC needs to do (e.g. OpenCV) live in a single script — no separate DRL program and inter-program socket.
- **Simpler than ROS2** to set up, while still supporting more than default DRL programming.
- **Cross-platform.** The same Python script should run unmodified on Linux and Windows, once the Windows build is fixed.
- **Compile once.** The C++ extension only needs to be rebuilt when the wrapper itself changes, not on every code edit.

## Troubleshooting

**Control box version.** The wrapper is only tested against control box **v2**. To target a **v3** box, change the compile flag in `setup.py`:

```python
extra_compile_args=[
    "-std=c++17",
    "-O2",
    "-fvisibility=hidden",
    "-DDRCF_VERSION=2", # <- change to "-DDRCF_VERSION=3" for a V3 control box
    "-DPYBIND11_DETAILED_ERROR_MESSAGES",
] if sys.platform != "win32" else ["/std:c++17", "/O2", "/DDRCF_VERSION=2"],

```

**Not every DRFL function is wrapped yet.** Control-rights functions, move commands, force feedback, and callbacks are implemented. Missing: welding commands, real-time control commands, and LED functions.

**Blocking calls.** Standard Python doesn’t have true multithreading, and several wrapper functions block until the robot responds — your script can’t do anything else while waiting. Run robot communication in a separate process using the [`multiprocessing`](https://docs.python.org/3/library/multiprocessing.html) module if you need to do other work (e.g. run a vision loop) at the same time.

## Related

- [How to connect a Doosan robot to a PC over a TCP socket (DRL Studio and Python)](https://www.robotexchange.io/t/how-to-connect-a-doosan-robot-to-a-pc-over-a-tcp-socket-drl-studio-and-python/4673) — the socket-based alternative if you’d rather keep DRL and PC code separate.
- [How to send data in a custom format between Python and DRL Studio](https://www.robotexchange.io/t/how-to-send-data-in-a-custom-format-between-python-and-drl-studio/4674) — designing a data protocol, relevant if you stick with the socket approach instead.

* * *

_Rewritten and consolidated (Sept 2026) from the original student how-to’s: [Controling the Doosan-robot using Python](https://www.robotexchange.io/t/controling-the-doosan-robot-using-python/4266)._
