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

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.

:warning: 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) 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).
  • 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, or a VM.
  • Windows: the C++ Visual Studio 2017 (or newer) runtime. :warning: Windows builds currently fail to compile (see Troubleshooting) — running Ubuntu via WSL is the current workaround.
  • Python 3, git, and the API-DRFL-Wrapper repository (which pulls in the official API-DRFL as a submodule).

Steps

1. Clone the wrapper

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:

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

Install the required packages:

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

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

python3 ./install.py

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

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:

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)

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

If PowerShell refuses to run the activation script, see this fix.

Install the Visual Studio C++ runtime 2017 or newer, then install the Python dependencies and compile:

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 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:

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 module if you need to do other work (e.g. run a vision loop) at the same time.

Related


Rewritten and consolidated (Sept 2026) from the original student how-to’s: Controling the Doosan-robot using Python.