python-step-series
A Python library for OSC communication with the Ponoor Step-series devices.
Welcome to python-step-series, a Python library to stupidly simplify communication with ponoor’s Step-series devices.
To get started, follow the simple example below and read the documentation to truly see what the Step-series devices have to offer.
Installation
There are multiple ways to install python-step-series. The easiest way is from PyPI:
pip install python-step-series
Or you can install from source. See the Contributing guide for more information on how to do that.
python-step-series requires Python >=3.7.
First-steps Example
from stepseries.commands import GetVersion, SetDestIP
from stepseries.step400 import STEP400
from stepseries.responses import OSCResponse, Version
def default_handler(message: OSCResponse) -> None:
print("Message received:", message)
def version_handler(message: Version) -> None:
print("Firmware:")
print(" - Name:", message.firmware_name)
print(" - Version:", message.firmware_version)
print(" - Compiled:", message.compile_date)
if __name__ == '__main__':
# Configurations that should be changed
dip_switch_id = 0 # Should match what is set on the device
local_ip_address = "10.1.21.56" # The ip address of the device
local_port = 50000
server_address = "0.0.0.0" # The address of the server; should always be 0.0.0.0 (the local machine)
server_port = 50100
# Create a device instance using the configurations above
# This does two things: creates a communication interface and starts up an OSC endpoint for
# the device to communicate with
device = STEP400(dip_switch_id, local_ip_address, local_port, server_address, server_port)
# Register a default handler for messages
# Typically, these are used to log events and print to stdout
# It is recommended to instead register 'filtered' handlers if
# you want to parse the message (like the one below)
device.on(None, default_handler)
# Register a handler just for version info
device.on(Version, version_handler)
# Enable communication with the device
device.set(SetDestIP())
# Get the current version of the firmware
version: Version = device.get(GetVersion())
Commands & Responses
python-step-series does its best to maintain a simple, yet intuitive API interface regardless of a developer’s experience level. As an example, the library provides a template for each command in a nice dataclass object. So, instead of writing
device.set("/setBemfParam 2 1500 200 127 43")
which might be prone to typing errors like mispelling or putting a parameter in the wrong spot, you instead write
from stepseries.commands import SetBemfParam
device.set(
SetBemfParam(
motorID=2,
INT_SPEED=1500,
ST_SLP=200,
FN_SLP_ACC=127,
FN_SLP_DEC=43
)
)
Also, the library will convert the response from the device into a usable dataclass object. For example, instead of a raw string response like
from stepseries.commands import GetBemfParam
resp = device.get(GetBemfParam(1))
print(resp)
>>> /bemfParam 1 1032 25 41 41
which you will then have to later interpolate, you will instead receive a response like
from stepseries.commands import GetBemfParam
from stepseries.responses import BemfParam
resp: BemfParam = device.get(GetBemfParam(1))
print(resp.INT_SPEED)
print(resp.FN_SLP_ACC)
print(resp)
>>> 1032
>>> 41
>>> BemfParam(motorID=1, INT_SPEED=1032, ST_SLP=25, FN_SLP_ACC=41, FN_SLP_DEC=41)
where all the interpolation has already been completed for you.
Making Changes & Contributing
Any ideas on how to improve this library are welcome. Please see the Contributing guide for a full run-down on how to contribute to this project as well as some tips for making sure your idea is added.
We thank you in-advance for your contributions.
Note
This project has been set up using PyScaffold 4.1.1. For details and usage information on PyScaffold see https://pyscaffold.org/.
Metadata
Release files for python-step-series 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-step-series-1.0.0.tar.gz | 6.3 MB | Without provenance | Details for python-step-series-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_step_series-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for python_step_series-1.0.0-py3-none-any.whl |
Total release size: 6.3 MB
Release files / python-step-series-1.0.0.tar.gz
| Download URL | python-step-series-1.0.0.tar.gz |
|---|---|
| Size | 6.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc1696cc1d63e92f25267ea04d016cf2ebf6391d4096f810162ca07a3f0c3cba
|
|
BLAKE2b-256 checksum How to use checksums |
ab6120f85597961501f938f3614fbfb77230f68d156f044279317cf327fc1562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|
Release files / python_step_series-1.0.0-py3-none-any.whl
| Download URL | python_step_series-1.0.0-py3-none-any.whl |
|---|---|
| Size | 28.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
736f086e3434b4a1f7d8a95460373c6b6fc7f26a33bb5df2f55ad8d108cd88bc
|
|
BLAKE2b-256 checksum How to use checksums |
ecfc8bbb37252fe5f4ca7f61adba7667ceaf0462f62c5ee3315962c73c8cf138
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.12
|
Security for python-step-series 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.