QuTech-Delft / QuTech-Delft/QMI

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

Open
#136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

QMI driver
Dominant language
Python
Stars
25
Forks
9
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

First read instruments.parallax and instruments.pololu, including their init.py files, then inspect the existing unit tests and check the relationship to issue #135. Compare the overlapping and hardware-specific APIs before choosing whether a shared Protocol, ABC, or coordinated driver APIs are appropriate. Done means the APIs are aligned, convenience and deprecated functions are removed, tests and CHANGELOG.md are updated, and hardware behavior is considered.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.