Package: python-step-series
python-step-seriesA Python library for OSC communication with the Ponoor Step-series devices.Welcome topython-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 thedocumentationto truly
see what the Step-series devices have to offer.InstallationThere are multiple ways to installpython-step-series. The easiest way is from PyPI:pipinstallpython-step-seriesOr you can install from source. See theContributingguide for more information
on how to do that.python-step-seriesrequires Python >=3.7.First-steps Examplefromstepseries.commandsimportGetVersion,SetDestIPfromstepseries.step400importSTEP400fromstepseries.responsesimportOSCResponse,Versiondefdefault_handler(message:OSCResponse)->None:print("Message received:",message)defversion_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 changeddip_switch_id=0# Should match what is set on the devicelocal_ip_address="10.1.21.56"# The ip address of the devicelocal_port=50000server_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 withdevice=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 infodevice.on(Version,version_handler)# Enable communication with the devicedevice.set(SetDestIP())# Get the current version of the firmwareversion:Version=device.get(GetVersion())Commands & Responsespython-step-seriesdoes 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 nicedataclassobject. So, instead of writingdevice.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 writefromstepseries.commandsimportSetBemfParamdevice.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 usabledataclassobject. For example, instead of a raw string response likefromstepseries.commandsimportGetBemfParamresp=device.get(GetBemfParam(1))print(resp)>>>/bemfParam11032254141which you will then have to later interpolate, you will instead receive a
response likefromstepseries.commandsimportGetBemfParamfromstepseries.responsesimportBemfParamresp: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 & ContributingAny ideas on how to improve this library are welcome. Please see theContributingguide 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.NoteThis project has been set up using PyScaffold 4.1.1. For details and usage
information on PyScaffold seehttps://pyscaffold.org/.