Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Parallax_UsbPropeller and Pololu_Maestro to use the same base API and remove convenience functions. #136

Open
heevasti opened this issue Feb 27, 2025 · 0 comments
Labels
QMI driver Addition or modification on a QMI driver

Comments

@heevasti
Copy link
Collaborator

heevasti commented Feb 27, 2025

Description

The instruments Parallax USB Propeller and Pololu (Micro) Maestro are both serial-to-USB based servo controllers. The drivers have been developed separately though, without considering the possible overlap in functionality. The resulting APIs are quite the same but with some calls with equal functionality with slightly different interface or use-case. Earlier, the Pololu Maestro had been modified somewhat to be more similar with Parallax USB Propeller driver. Some functions were then copied and renamed to match the Parallax ones and the old ones left with deprecation warnings. Some other functions were not considered, and a few more functions that remain are most likely hardware|firmware-specific and cannot be generalized anyhow.

It would be now time to unify the driver base and clean-up the APIs. Note also that this could be done either before or after the ticket #135 but preferably after.

One solution would be a creation of a virtual instrument driver 'servo/control.py' in 'instruments' or 'servo_control.py' in 'utils'. This could be a Protocol or ABC or simple base class, but preferably one of the two former. Consider well the Protocol|ABC class which calls you want to define for both and with which exact interface and functionality. The API can be broken if necessary to make the functions more sensible and generic - the current function names are derived from specific use-cases in Diamondos.

If no base class | Protocol | ABC is desired, just line-out the function names on each driver to be with matching names and functionalities and drop deprecation warnings and respective functions. Also drop 'convenience functions'. Update unit-tests accordingly.

Modules to be created

Optionally:

  • instruments/servo/control.py or utils/servo_control.py

Modules to be modified

  • instruments.parallax (also __init__.py)
  • instruments.pololu (also __init__.py)

Tests to be created/updated

Update unit-tests accordingly.

Documentation to be updated

Update CHANGELOG.md.

Hardware

Could be useful test with the HW as well of Protocol | ABC class is used.

@heevasti heevasti added the QMI driver Addition or modification on a QMI driver label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QMI driver Addition or modification on a QMI driver
Projects
None yet
Development

No branches or pull requests

1 participant