Simple FANUC RMI client
Project description
fanuc-rmi
Python client for FANUC RMI over TCP sockets.
Requirements
- Python
>=3.11 - FANUC controller with RMI option enabled
- Network access from this machine to the controller
Install
python3 -m venv .venv
source .venv/bin/activate
pip install fanuc-rmi
Quick Start
from fanuc_rmi import RobotClient
robot = RobotClient(host="192.168.1.22", startup_port=16001, main_port=16002)
robot.connect()
robot.initialize(uframe=0, utool=1)
print(robot.get_uframe_utool())
robot.close()
Core Behavior
initialize(uframe, utool)sends:FRC_ResetFRC_InitializeFRC_SetUFrameUTool
- Motion calls (
linear_*,joint_relative) includeConfiguration.UFrameNumber/UToolNumberin each packet. - Defaults in motion APIs are
uframe=0,utool=1.
Motion APIs
# speed override
robot.speed_override(20)
# sequence-ordered wait
robot.wait_time(0.5, sequence_id=1)
# linear relative (mm / deg)
robot.linear_relative(
{"X": 10, "Y": 0, "Z": 0, "W": 0, "P": 0, "R": 0},
speed=150,
sequence_id=2,
uframe=0,
utool=1,
)
# linear absolute (mm / deg)
robot.linear_absolute(
{"X": 540, "Y": -150, "Z": 500, "W": -170, "P": 0, "R": 165},
speed=150,
sequence_id=3,
uframe=0,
utool=1,
)
# joint relative (deg)
robot.joint_relative(
{"J1": 0, "J2": 0, "J3": 0, "J4": 0, "J5": 0, "J6": 0, "J7": 0, "J8": 0, "J9": 0},
speed_percentage=20,
sequence_id=4,
uframe=0,
utool=1,
)
# joint absolute (deg)
robot.joint_absolute(
{"J1": 0, "J2": 0, "J3": 0, "J4": 0, "J5": 0, "J6": 0},
speed_percentage=20,
sequence_id=5,
)
Frame/Tool Selection
There are two ways to set frame/tool values:
- Immediate controller selection command:
robot.set_uframe_utool(uframe=1, utool=1)
Use this only when robot motion is stopped.
- Queued TP instructions in the instruction stream:
sid = 1
robot.linear_absolute(pose0, speed=150, sequence_id=sid, uframe=0, utool=1)
sid += 1
robot.set_uframe(frame_number=1, sequence_id=sid)
sid += 1
robot.set_utool(tool_number=1, sequence_id=sid)
sid += 1
robot.linear_absolute(pose1, speed=150, sequence_id=sid, uframe=1, utool=1)
For mixed-frame jobs, use strictly increasing SequenceID values for all queued instructions and moves.
Read APIs
# current pose/joints (also appended to JSONL files)
cartesian = robot.read_cartesian_coordinates() # ./robot_position_cartesian.jsonl
joints = robot.read_joint_coordinates() # ./robot_position_joint.jsonl
# active selection
active = robot.get_uframe_utool()
# frame/tool records
uframe_1 = robot.read_uframe_data(1)
utool_1 = robot.read_utool_data(1)
robot.write_uframe_data(2, {"X": 0, "Y": 0, "Z": 0, "W": 0, "P": 0, "R": 0})
robot.write_utool_data(3, {"X": 10, "Y": 0, "Z": 120, "W": 0, "P": 0, "R": 0})
Numbering Notes
UFRAMEselection supports0..9.UFRAME 0is the controller world/default frame.FRC_ReadUFrameData/FRC_WriteUFrameDataare typically used with1..9.UTOOLon this setup is1..9.
Troubleshooting
If you see RMI_MOVE invalid frame number:
- Confirm the frame exists and is valid on the controller.
- For runtime frame changes, queue
set_uframe/set_utoolbefore the move. - Keep
SequenceIDmonotonic across all packets. - Do not call
set_uframe_utoolwhile motion is active.
Extras
configuration_visualization.py provides a GUI to inspect and visualize FANUC configuration bits (Front/Up/Left/Flip, Turn4/5/6), including loading the latest packet from robot_position_cartesian.jsonl.
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 fanuc_rmi-0.3.0.tar.gz.
File metadata
- Download URL: fanuc_rmi-0.3.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6f562f02041c4dce2f8855dc6838156ae338135141afe7f9d633ee85ad1f013
|
|
| MD5 |
f8be724d08f7d792178e5040208c890c
|
|
| BLAKE2b-256 |
66fe2235270599a280bbf9aab3b434a14874939b57dfdc95aaa6d3c4049a0b96
|
File details
Details for the file fanuc_rmi-0.3.0-py3-none-any.whl.
File metadata
- Download URL: fanuc_rmi-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e37f8a08bf6c344e72760c8a4a991a8639a758efde1f6ce6ecba81dc494d2316
|
|
| MD5 |
c13f1e8cf66ba6140991594e98ff20a9
|
|
| BLAKE2b-256 |
679d3b2295837870e1115310d049a15d061aee2a1352e86503a5e79b16032be4
|