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

Add developer documentation for hardware framework #379

Merged
merged 4 commits into from
Nov 23, 2023

Conversation

alexdewar
Copy link
Collaborator

This potentially could be more detailed, but hopefully there's enough information in here for would-be contributors to get started.

@CWestICL: Would you mind reviewing this and checking that it makes sense to you? You're currently the target audience for it 😉

Closes #366.

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5138d67) 79.04% compared to head (847393a) 79.04%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #379   +/-   ##
=======================================
  Coverage   79.04%   79.04%           
=======================================
  Files          56       56           
  Lines        2925     2925           
=======================================
  Hits         2312     2312           
  Misses        613      613           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really good. I've pointed a couple of things that could be polished, but having this documentation will make life much easier to future developers, including ourselves!

docs/hardware.md Outdated Show resolved Hide resolved
docs/hardware.md Outdated
Comment on lines 69 to 74
### Device parameters

Devices can also require additional parameters to be specified by the user, such as port
and baudrate for serial devices. Details about these parameters are set in an
`__init_subclass__()` method for the class. These parameters will be passed as arguments
to the device type's constructor when it is opened.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very unclear - or at least ambiguous. Are these parameters passed to the __init_subclass__ method, and therefore need to be included in the subclass definition, or are they pass when constructing the object? And example, as you have done above, will be useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done now

Comment on lines +96 to +98
Device types also need to define their own message types for communication. For example,
the `StepperMotorBase` class allows for setting the current angle of the stepper motor
with a `device.stepper_motor.move.begin` message.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be useful, I think, to indicate somewhere the list of all possible messages a particular device type handles - either sending or receiving. In the end, pubsub topics are implicit function calls with their own parameters and they should be documented in detail as we do with any other function.

We have never done it before, but given the complexity of the messaging system of FINESSE, it might be worth considering doing something like this https://pypubsub.readthedocs.io/en/v4.0.3/usage/usage_advanced_maintain.html#specify-topic-tree-def, although as most topics are created implicitely based on the device names, I'm not sure how far we can go down this route...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

The doc you link to looks interesting. I'll see if we can incorporate that way of doing things 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea, but I think we should do it later. I've opened an issue for it: #432

Copy link
Contributor

@CWestICL CWestICL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than some of the points that Diego has brought up, it all makes sense to me! Don't think I have any other changes to add.

Copy link
Contributor

@dc2917 dc2917 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny, single-word change but otherwise this looks good! Very informative and concise.

docs/hardware.md Outdated Show resolved Hide resolved
@alexdewar alexdewar merged commit 389511d into main Nov 23, 2023
13 checks passed
@alexdewar alexdewar deleted the hardware_documentation branch November 23, 2023 14:22
alexdewar added a commit that referenced this pull request Apr 17, 2024
…tion

Add developer documentation for hardware framework
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write developer documentation for core hardware code
4 participants