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.
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
1through6. - Axis-based TCP methods accept
"X","Y","Z","RX","RY", and"RZ". - Analog-output helper methods accept analog output numbers
1through16. - Floating-point values are encoded as big-endian 32-bit floats.
- The class connects automatically by default. Pass
auto_connect=Falseif you want to control connection timing manually.
Error Handling
The library raises:
ValueErrorfor invalid joint numbers, axis names, and analog output numberspymodbus.exceptions.ModbusExceptionwhen 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
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 jakamodbuscommunication-4.0.9-py3-none-any.whl.
File metadata
- Download URL: jakamodbuscommunication-4.0.9-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.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39577c5b88f190b7db6777361329bf8e8e090f3eb70f205eefdd468741b3d7c4
|
|
| MD5 |
c7219ae600fbcf949611e501ee24e254
|
|
| BLAKE2b-256 |
177a846f885ec3d220747ded5f4b44bfa959c6f32c7bc65ecc7c89cfd5540fcf
|