Python API for controlling Techman (TM) robots via Listen Node — no TMScript required
Project description
pytmrobot
Python API for Techman (TM) Robots — control your TM robot without writing TMScript.
Features
| Category | Capabilities |
|---|---|
| Motion | PTP, Line, Circle, relative moves, PVT trajectories |
| I/O | Digital / analog output & input, batch read |
| State | TCP position, joint angles, force, speed, snapshot |
| Force sensing | TouchStop, Compliance, Force control (FTSensor) |
| Communication | Modbus TCP read/write with named Presets |
| Vision | Trigger vision jobs, read output poses |
| HMI | Operator dialogs (choice + popup) |
| Multi-robot | Each TMRobot instance is fully independent — run 12+ in parallel |
Requirements
- Python 3.10+
- TM Robot running TMflow 1.80+ with a Listen Node in the flow
- Network access to port 5890 on the robot controller
No external dependencies — only the Python standard library.
Installation
pip install pytmrobot
Or install from source:
git clone https://github.com/harry-techman/pytmrobot.git
cd pytmrobot
pip install -e .
Quick Start
from pytmrobot import TMRobot, CartPoint
with TMRobot("192.168.1.101") as robot:
home = CartPoint(400, -100, 500, 180, 0, 90) # X, Y, Z, Rx, Ry, Rz
pick = CartPoint(400, -100, 280, 180, 0, 90)
robot.move.ptp(home, speed=30) # point-to-point move, 30 %
robot.move.ptp(pick, speed=10) # slow approach
robot.io.set_do(2, True) # close gripper (DO[2] = 1)
robot.sleep(500) # wait 500 ms on robot side
robot.move.ptp(home, speed=30)
robot.io.set_do(2, False) # open gripper
pos = robot.state.tcp_position # read current TCP pose
print(f"Done — X={pos[0]:.1f} Y={pos[1]:.1f} Z={pos[2]:.1f} mm")
Sub-controllers
| Property | Description |
|---|---|
robot.move |
PTP / Line / Circle / relative / PVT |
robot.io |
DO, AO, DI, AI, batch read |
robot.state |
TCP position, joints, force, speed, snapshot |
robot.decision |
ask() choice dialog, popup() confirmation |
robot.modbus |
Modbus TCP connect / preset / read / write |
robot.touchstop |
TouchStop — detect contact and stop |
robot.compliance |
Compliance — compliant motion until resistance |
robot.force |
Force control with external FTSensor |
robot.vision |
Trigger vision jobs, get output pose |
More Examples
Read robot state
s = robot.state.snapshot()
print(s.tcp_position) # (X, Y, Z, Rx, Ry, Rz)
print(s.joint_angles) # (J1 … J6)
print(s.tcp_force_3d) # resultant force N
TouchStop — find workpiece surface
result = robot.touchstop.run(
direction=32, # Z− (1=X+, 2=X−, 4=Y+, 8=Y−, 16=Z+, 32=Z−)
distance=50.0, # max travel mm
force=5.0, # contact threshold N
speed=10,
)
if result == 5: # Resisted
z = robot.touchstop.get_stopped_pos()[2]
print(f"Surface at Z = {z:.2f} mm")
Multi-robot (12 concurrent)
from concurrent.futures import ThreadPoolExecutor
robots = [TMRobot(f"192.168.1.{100+i}") for i in range(12)]
for r in robots:
r.connect()
with ThreadPoolExecutor(max_workers=12) as pool:
futures = [pool.submit(run_task, r) for r in robots]
for f in futures:
f.result()
for r in robots:
r.disconnect()
Modbus TCP
robot.modbus.connect("192.168.1.10")
robot.modbus.preset("light", 1, "DO", 7206, "bool")
robot.modbus.write("light", True)
print(robot.modbus.read_bool("light"))
robot.modbus.disconnect()
Vision-guided pick
if robot.vision.do_job("DetectPart"):
pose = robot.vision.get_output_pose("DetectPart", "ArmPose_0")
robot.move.ptp(CartPoint(*pose), speed=20)
Running Tests
pip install -e ".[dev]"
python -m pytest tests/ -v
All 259 tests run without a physical robot (mock-based unit tests).
Documentation
Full API reference and tutorials (繁體中文): docs/wiki.md
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytmrobot-0.1.1.tar.gz.
File metadata
- Download URL: pytmrobot-0.1.1.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
356ad366af3780abc5afd7dd90030073fb35ddbeb17305659cfd05e5b4657699
|
|
| MD5 |
975a6da37928ee824d15f41678f44e17
|
|
| BLAKE2b-256 |
cdbb892d155efe70e606ff6abb7ef2775d5dd94f84f275833d616318a097f305
|
File details
Details for the file pytmrobot-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pytmrobot-0.1.1-py3-none-any.whl
- Upload date:
- Size: 46.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81b688d164c43b6b8119e35ee756069ffbd5acf7b86350a908320454cc12f8f9
|
|
| MD5 |
572b769792c216d1414b18e30a0f9157
|
|
| BLAKE2b-256 |
02de6e17a23610de7250603a1b84e5cc8925b091bf06849f46c10f70191211dc
|