Skip to main content

Simple FANUC RMI client

Project description

FANUC RMI Client

Python client for FANUC RMI with reusable functions.

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)

active = robot.get_uframe_utool()

robot.close()

Motion Commands

All motion methods accept uframe and utool arguments (defaults are 1 and 1).

# set speed override (controller-specific range)
robot.speed_override(50)

# wait in seconds (uses sequence_id for ordering)
robot.wait_time(2.5, sequence_id=5)

# linear relative motion (mm / deg)
relative_displacement = {"X": 100, "Y": 0, "Z": 0, "W": 0, "P": 0, "R": 0}
robot.linear_relative(relative_displacement, speed=500, sequence_id=1, uframe=1, utool=1)

# linear absolute motion (mm / deg)
absolute_position = {
    "X": 491.320, "Y": -507.016, "Z": 223.397,
    "W": -179.577, "P": 52.380, "R": -93.233,
}
robot.linear_absolute(absolute_position, speed=300, sequence_id=2, uframe=1, utool=1)

# joint relative motion (deg)
relative_joints = {"J1": 0, "J2": 0, "J3": 0, "J4": 0, "J5": 0, "J6": 0, "J7": 0, "J8": 0, "J9": 0}
robot.joint_relative(relative_joints, speed_percentage=40, sequence_id=3, uframe=1, utool=1)

# joint absolute motion (deg)
absolute_joints = {
    "J1": 63.252, "J2": 31.488, "J3": -35.602,
    "J4": 18.504, "J5": -101.313, "J6": 108.650,
    "J7": 0.000, "J8": 0.000, "J9": 0.000,
}
robot.joint_absolute(absolute_joints, speed_percentage=40, sequence_id=4, uframe=1, utool=1)

Read APIs

# current pose (also appends to local txt files)
cartesian = robot.read_cartesian_coordinates()  # ./robot_position_cartesian.txt
joints = robot.read_joint_coordinates()         # ./robot_position_joint.txt

# active frame/tool selection on controller
active = robot.get_uframe_utool()

# frame/tool data 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})

UFRAME / UTOOL Numbering

  • UFRAME selection supports 0..9.
  • UFRAME 0 is the controller default/world frame (valid to select/use).
  • FRC_ReadUFrameData / FRC_WriteUFrameData should use 1..9. Using 0 may return an error.
  • UTOOL selection is 1..9 on this setup.
  • No practical UTOOL 0 is used in this project.

Notes

  • Requires Python 3.11+.
  • main.py is a runnable example script.

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

fanuc_rmi-0.2.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fanuc_rmi-0.2.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file fanuc_rmi-0.2.0.tar.gz.

File metadata

  • Download URL: fanuc_rmi-0.2.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fanuc_rmi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f1a064cb271f4cfc3d50b9128cc24733ae40fc39eeee3b6a0ec34101dbeb00b6
MD5 dc693f454eb66a5259d5347cd9734663
BLAKE2b-256 15e9c24428300f55592a269176dcffed7393a135eb7a358ffeee8ff09fd3bf0d

See more details on using hashes here.

File details

Details for the file fanuc_rmi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: fanuc_rmi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fanuc_rmi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 249a9b061c4ea7f9546107ffb6f229b6d46b3aba373f025f4c47c84cfe703b29
MD5 4bb9ded1ccb50dc1164cac2b7b52c6d4
BLAKE2b-256 e7fdb57851fceae9beca1b8bc2d6e3f4818213e1c960ab520628afe672ec8011

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page