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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for jakamodbuscommunication-4.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 39577c5b88f190b7db6777361329bf8e8e090f3eb70f205eefdd468741b3d7c4
MD5 c7219ae600fbcf949611e501ee24e254
BLAKE2b-256 177a846f885ec3d220747ded5f4b44bfa959c6f32c7bc65ecc7c89cfd5540fcf

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