A Python package for communicating with the Orca motor using Modbus.
Project description
pyOrcas
A Python package for communicating with the Orca motor using Modbus.
Installation
pip install pyOrcas
The Actuator Structure
The Actuator class in pyOrcas provides a modbus driven interface to interact with the Orca motors. Here's an overview of its structure and the available methods:
Initialization
To initialize the Actuator object, provide the COM port and baud rate:
from pyOrcas import Actuator
actuator = Actuator(port='COM3', baudrate=9600)
#Update com port and baud rate to match the motor. Higher baud rates enable higher speeds.
Closing the Port
Closing the serial port is important to ensure continued capability. When the object is deleted, it automatically closes the port. Recommendations:
- At the end
Properties
The Actuator class has several properties for reading various states and parameters:
- position: Gets or sets the position of the actuator in micrometers.
- force: Gets or sets the force exerted by the actuator in milliNewtons.
- power: Gets the current power consumption of the actuator.
- temperature: Gets the current temperature of the actuator.
- voltage: Gets the current voltage of the actuator.
- errors: Gets any error codes from the actuator.
- op_mode: Gets the current operation mode of the actuator.
Methods
The Actuator class provides several methods for communication and control:
- close(): Closes the Modbus connection.
- read_register(register_address, num_registers): Reads Modbus registers.
- write_registers(registers_start_address, register_data): Writes multiple values to consecutive Modbus registers.
- write_stream(registers_start_address, width, value): Writes a stream to the Modbus.
- read_stream(register_address, width): Reads a stream from the Modbus.
Refer to the following user guide for documentation on the commands. https://irisdynamics.com/hubfs/Website/Downloads/Orca/Approved/UG210912_Orca_Series_Modbus_RTU_User_Guide.pdf
- sleep(): Puts the motor to sleep.
- Tune_PID(saturation, p_gain, i_gain, dv_gain, de_gain): Tunes the PID controller.
Haptic Mode
The Actuator class has a nested _HapticMode class for handling haptic effects. Here are the available methods:
- enable(): Enables the haptic mode.
- set_spring(ID, gain, center, deadzone, saturation, coupling=0, enable=None): Sets the parameters of a spring effect. ID: 0, 1, 2
- toggle_spring(ID, enable=True): Enables or disables a spring effect.
- set_oscillator(ID, gain, osctype, freq, duty, enable=None): Sets the parameters of an oscillator effect. ID: 0, 1
- toggle_oscillator(ID, enable=True): Enables or disables an oscillator effect.
- set_force(gain, enable=None): Sets a constant force effect.
- toggle_force(enable=True): Enables or disables the constant force effect.
- set_damper(gain, enable=None): Sets a damper effect.
- toggle_damper(enable=True): Enables or disables the damper effect.
- set_inertia(gain, enable=None): Sets an inertia effect.
- toggle_inertia(enable=True): Enables or disables the inertia effect.
- toggle_effects(f=False, s0=False, s1=False, s2=False, d=False, i=False, o1=False, o2=False): Toggles multiple haptic effects at once.
Kinematic Mode
The Actuator class has a nested _KinematicMode class for handling kinematic motions. Here are the available methods:
- enable(): Enables the kinematic mode.
- set_motion(ID, position, time, delay, nextID, autonext, motion_type=0): Sets the parameters of a kinematic motion.
- trigger(ID): Triggers a kinematic motion by its ID.
Updating the PyPI Release
To update the PyPI release of pyOrcas, follow these steps:
-
Update the version number in setup.py.
-
Build the distribution:
python setup.py sdist bdist_wheel
- Upload the package to PyPI:
twine upload dist/*
Make sure you have twine installed and configured with your PyPI credentials.
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
File details
Details for the file pyorcas-0.1.7.tar.gz
.
File metadata
- Download URL: pyorcas-0.1.7.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcb1b85695406520f92bccfd76bc054371e848404ea08a610a4ac9940f7a5812 |
|
MD5 | 77ec178522375deaa59b2b3e0cda6e0d |
|
BLAKE2b-256 | 55a2c172ae5bdd940c4acb38fc362a26f72911095d8f59c4de9afedc52247ac4 |
File details
Details for the file pyOrcas-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: pyOrcas-0.1.7-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cd11e47eb053f5b01c50e86a37e8715b664be91a6cc7d0f67a8164d54753278 |
|
MD5 | edba4858024f7c43a305033f0c78f770 |
|
BLAKE2b-256 | e81c0b1707e4291ef475892eeae1f1a793ac8b13bb38822234909d5fb5822abd |