Staubli Robot Communication SDK for Python
UnderAutomation.Staubli is a Python package that communicates with Staubli CS8 and CS9 robot controllers through the SOAP server of the controller. Nothing is installed on the controller. No other Staubli software is needed on the PC.
Use it to read the robots and the controller parameters, read positions, compute the kinematics, move the robot, read and write I/O, and manage VAL 3 applications and tasks, from a Python script.
- Product page: underautomation.com/staubli
- Documentation: underautomation.com/staubli/documentation/get-started-python
- Also available for .NET: Staubli.NET. LabVIEW: available on request, contact us.
How it works
The package wraps the .NET library UnderAutomation.Staubli.dll with pythonnet.
The DLL is inside the package: pip install installs everything, including pythonnet.
-
Windows: the DLL runs on the .NET Framework 4.x of Windows. Nothing else to install.
-
Linux and macOS: install the .NET runtime (for example .NET 8), then tell pythonnet to use it before you start Python:
export PYTHONNET_RUNTIME=coreclr
Without this variable, pythonnet uses Mono, its default runtime on Linux and macOS. You can also choose the runtime in your code, before the first import of the package:
from pythonnet import load load("coreclr")
Installation
Python 3.7 to 3.13 is supported (the limit of pythonnet 3.0.5). Install the package in a virtual environment:
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux and macOS
source .venv/bin/activate
pip install UnderAutomation.Staubli
Or install it from the sources of this repository:
git clone https://github.com/underautomation/Staubli.py.git
cd Staubli.py
pip install -e .
Getting started
from underautomation.staubli.staubli_controller import StaubliController
from underautomation.staubli.connection_parameters import ConnectionParameters
# The SDK runs in trial mode for 30 days. Register your key to remove the trial limit.
# StaubliController.register_license("Your Company", "your-license-key")
parameters = ConnectionParameters("192.168.0.254")
parameters.soap.user = "default" # user of the controller
parameters.soap.password = "default"
parameters.soap.port = 851 # default SOAP port
controller = StaubliController()
controller.connect(parameters)
joints = controller.soap.get_current_joint_position(0)
print(list(joints))
controller.disconnect()
parameters.ping_before_connect (True by default) pings the controller before the connection.
From .NET names to Python names
The Python API is the .NET API with Python names. The .NET documentation applies to Python.
| .NET | Python |
|---|---|
Method GetCurrentJointPosition(0) |
get_current_joint_position(0) |
Property Soap.User |
soap.user |
Static method StaubliController.RegisterLicense(...) |
StaubliController.register_license(...) |
Enum value LicenseState.Trial |
LicenseState.Trial (an IntEnum) |
Array double[] |
list-like object, use list(...) to copy it |
Nullable<int> |
int | None |
Each type is in the module named after it, in snake case:
UnderAutomation.Staubli.Soap.Data.MotionDesc is underautomation.staubli.soap.data.motion_desc.MotionDesc.
Features
Everything is reached through controller.soap.
Controller and robots
robots = controller.soap.get_robots()
for parameter in controller.soap.get_controller_parameters():
print(parameter.name, parameter.value)
dh = controller.soap.get_dh_parameters(0)
joint_range = controller.soap.get_joint_range(0)
Positions and kinematics
joints = controller.soap.get_current_joint_position(0)
position = controller.soap.get_current_cartesian_joint_position(0)
print(position.cartesian_position.x, position.cartesian_position.y, position.cartesian_position.z)
# Joints to frame, then frame to joints
fk = controller.soap.forward_kinematics(0, joints)
ik = controller.soap.reverse_kinematics(0, joints, fk.position, fk.config, joint_range)
print(list(ik.joint), ik.result)
Motion
from underautomation.staubli.soap.data.motion_desc import MotionDesc
from underautomation.staubli.soap.data.frame import Frame
mdesc = MotionDesc()
mdesc.velocity = 50 # % of the nominal joint speed
mdesc.acceleration = 100 # %
mdesc.deceleration = 100 # %
mdesc.translation_velocity = 250 # mm/s
mdesc.rotation_velocity = 100 # deg/s
mdesc.tool = Frame()
mdesc.frame = Frame()
controller.soap.set_power(True)
result = controller.soap.move_jj(0, [0, 0, 90, 0, 90, 0], mdesc)
print(result.return_code)
target = Frame()
target.px, target.py, target.pz = 300, 0, 450
controller.soap.move_l(0, target, mdesc)
controller.soap.stop_motion()
controller.soap.set_power(False)
Inputs / Outputs
for io in controller.soap.get_all_physical_ios():
print(io.name, io.type_str, io.description)
states = controller.soap.read_ios(["BasicDO_1"])
print(states[0].value, states[0].state)
responses = controller.soap.write_ios(["BasicDO_1"], [1.0])
VAL 3 applications and tasks
controller.soap.load_project("Disk://myProject/myProject.pjx")
for application in controller.soap.get_val_applications():
print(application.name, application.loaded, application.is_running)
for task in controller.soap.get_tasks():
print(task.name, task.state, task.created_by)
controller.soap.stop_and_unload_all()
Examples
The folder examples contains scripts ready to run. The first run asks the address of the
controller, the SOAP user, the password and the port, and saves them in examples/robot_config.json. It
also checks the license and asks a key when the trial has ended.
| Script | What it does |
|---|---|
examples/controller/controller_info.py |
Controller parameters, robots, DH parameters and joint ranges. |
examples/motion/motion_move_robot.py |
Positions, forward and inverse kinematics, then a joint move to the zero position. |
examples/io/io_read.py |
Lists the physical I/O, then reads the I/O you choose. |
examples/io/io_write.py |
Lists the physical I/O, then writes the I/O you choose. |
examples/applications/applications_load_start.py |
Lists the VAL 3 applications, loads and starts a project, then suspends, resumes and kills its task. |
Run a script from the root of the repository:
python examples/controller/controller_info.py
examples/motion/motion_move_robot.py moves the robot. Check the surroundings of the robot first.
Compatibility
- Python: 3.7 to 3.13, with pythonnet 3.0.5.
- Operating systems: Windows (.NET Framework), Linux and macOS (.NET runtime and
export PYTHONNET_RUNTIME=coreclr). - Controllers: Staubli CS8 and CS9, and the emulator of Staubli Robotics Suite.
License
This SDK needs a commercial license. A 30-day trial starts at the first use, no key needed. After the trial, register your key in your code:
from underautomation.staubli.staubli_controller import StaubliController
license_info = StaubliController.register_license("Your Company", "your-license-key")
print(license_info.state)
- License agreement: underautomation.com/staubli/eula and License.md
- Trial key: underautomation.com/license
- Prices and quote: underautomation.com/staubli
Support
- Documentation: underautomation.com/staubli/documentation
- Issues: GitHub Issues
- Contact: underautomation.com/contact
Metadata
Release files for UnderAutomation.Staubli 0.5.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| underautomation_staubli-0.5.0.0.tar.gz | 68.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| underautomation_staubli-0.5.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 187.2 kB
Release files / underautomation_staubli-0.5.0.0.tar.gz
| Download URL | underautomation_staubli-0.5.0.0.tar.gz |
|---|---|
| Size | 68.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40f2ce16f5110e1a45276939101fd3f76c82b7993cf408f690b25d2ddb7994b6
|
|
BLAKE2b-256 checksum How to use checksums |
ba7052830aa88e2aaf7ec2ce9fd8c4b381f8a2f23d714e266ebf41789197bc86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / underautomation_staubli-0.5.0.0-py3-none-any.whl
| Download URL | underautomation_staubli-0.5.0.0-py3-none-any.whl |
|---|---|
| Size | 119.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
797cb2249f3b5c791bf75076798fe90ffe0b750b339340198bb251cc37cef883
|
|
BLAKE2b-256 checksum How to use checksums |
94519034da7eb1f128efe650e56da2ea5f9916db5e2213b577bfe30eaf4e95d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|