Skip to main content

A Modbus helper library for Jaka communication.

Project description

JakaModbusCommunication

JakaModbusCommunication is a lightweight Python library for communicating with JAKA collaborative robots over Modbus TCP. It wraps common register reads and writes behind a small, task-focused API for digital I/O, analog values, and robot status data.

PyPI package

Highlights

  • Connect to a JAKA controller over Modbus TCP
  • Read general, cabinet, and tool digital inputs
  • Write digital outputs and analog outputs
  • Read integer and floating-point register values
  • Query robot telemetry such as joint voltage, temperature, current, position, speed, and TCP data
  • Read controller status flags including power, enable, emergency stop, in-position state, and error indicators

Installation

Install from PyPI:

pip install JakaModbusCommunication

The package depends on pymodbus, which is installed automatically.

Quick Start

from JakaModbusCommunication import Jaka_Coms

jaka = Jaka_Coms(host="192.168.1.186", port=502)

try:
    powered_on = jaka.get_power_on_status()
    joint_1_voltage = jaka.get_joint_voltage(1)
    tcp_x = jaka.get_tcp_position("X")

    print(f"Powered on: {bool(powered_on)}")
    print(f"Joint 1 voltage: {joint_1_voltage:.2f} V")
    print(f"TCP X: {tcp_x:.3f}")
finally:
    jaka.close()

Common Operations

Read digital inputs

input_state = jaka.read_modbus_input_state(input_number=1)
cab_input = jaka.read_jaka_cab_input_state_mini(input_number=3)
tool_input = jaka.read_jaka_tool_input_state(input_number=1)

Write digital outputs

jaka.write_digital_modbus_output(output_number=5, state=True)
jaka.write_digital_cab_mini_output(output_number=2, state=False)

Read analog values

unsigned_value = jaka.read_int16(ao_number=3)
signed_value = jaka.read_sign16(ao_number=7)
float_value = jaka.read_float32(address=150)

Write analog values

jaka.write_analog_output_int(ao_number=4, value=1234)
jaka.write_analog_output_sign(ao_number=6, value=-123)
jaka.write_analog_output_float32(ao_number=2, value=12.34)

Read robot status

joint_voltage = jaka.get_joint_voltage(joint=1)
joint_position = jaka.get_joint_position(joint=3)
joint_temperature = jaka.get_joint_temperature(joint=2)
movement_mode = jaka.get_movement_mode()

API Notes

  • Joint-based methods accept joint numbers 1 through 6.
  • Axis-based TCP methods accept "X", "Y", "Z", "RX", "RY", and "RZ".
  • Analog-output helper methods accept analog output numbers 1 through 16.
  • Floating-point values are encoded as big-endian 32-bit floats.
  • The class connects automatically by default. Pass auto_connect=False if you want to control connection timing manually.

Error Handling

The library raises:

  • ValueError for invalid joint numbers, axis names, and analog output numbers
  • pymodbus.exceptions.ModbusException when a Modbus request fails

Example:

from pymodbus.exceptions import ModbusException

try:
    speed = jaka.get_joint_speed(joint=1)
except ValueError as exc:
    print(f"Invalid input: {exc}")
except ModbusException as exc:
    print(f"Modbus request failed: {exc}")

Development

Clone the repository and install the package in editable mode:

pip install -e .

Run the tests:

python -m unittest discover -s tests

License

This project is licensed under the MIT License. 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

jakamodbuscommunication-4.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

jakamodbuscommunication-4.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file jakamodbuscommunication-4.1.tar.gz.

File metadata

  • Download URL: jakamodbuscommunication-4.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for jakamodbuscommunication-4.1.tar.gz
Algorithm Hash digest
SHA256 1132cefe7929dd61f38bba7d9a46736c14f4fee88ed4d53e4f19b17beb91ae65
MD5 72f9b802e22bf17a36033115e14353b3
BLAKE2b-256 fd7a19168ca3ac9e9ef0c78d3822afcc4ba4c5c10caa004a82aea11eb09f59c9

See more details on using hashes here.

File details

Details for the file jakamodbuscommunication-4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jakamodbuscommunication-4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2be07fb50923745037e86d9eeb93a1105762580115204d05f794630d36a00cae
MD5 75862c79a3bbe870fd32d33c3544407f
BLAKE2b-256 9edd9583f2da9825f71e2d151e37669785e654721cd1957f0488352e2acbdff8

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