Skip to content

RSDK-4172 - update wifi sensor #393

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

Merged

Conversation

purplenicole730
Copy link
Member

@purplenicole730 purplenicole730 commented Aug 21, 2023

  • Added optional section for reconfig and validation functions
  • Added WIP check-ins so users can reference in between steps. NOTE: Since the files don't sit in the repo yet, the links will lead you to nowhere. The links will be the three added files in this PR once merged.
  • Clarified that the step of making an entry-point file is actually just starting the module

@purplenicole730 purplenicole730 requested a review from a team as a code owner August 21, 2023 18:08
@purplenicole730 purplenicole730 requested review from clintpurser, cheukt and dannenberg and removed request for clintpurser August 21, 2023 18:08
Copy link
Contributor

@dannenberg dannenberg left a comment

Choose a reason for hiding this comment

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

looks good! once published, i'll fwd to the contractor who had some struggles with the old format and see if it helps her. thanks as always for putting such strong efforts into docs!

Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

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

I think we should move the examples out of your personal gist into something a bit more official. Also, there's a bug in your gist: your main functions don't close parens properly. Also, the main function doesn't have to be async since nothing awaitable is happening

"If a validator function is added, it must also be called when registering the resource. The `ResourceCreatorRegistration` should now also have the validator function passed in as the second parameter. \n",
"\n",
"```python\n",
" async def main():\n",
Copy link
Member

Choose a reason for hiding this comment

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

We should not have main functions in these files

Copy link
Member Author

Choose a reason for hiding this comment

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

This was added previously in another PR. The wifi_sensor.py was changed by @cheukt to have the main function there.

Comment on lines 337 to 341
"async def main():\n",
" Registry.register_resource_creator(Sensor.SUBTYPE, MySensor.MODEL, ResourceCreatorRegistration(MySensor.new))\n",
"```\n"
"```\n",
"\n",
"Click [here](https://gist.github.com/purplenicole730/dc3ddd9d53fd5da16c3bde0e0a6a63f4#file-module_step2-py) to see the file with its new `MODEL` variable, creator function, and `main()` function.\n",
Copy link
Member

Choose a reason for hiding this comment

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

Again, we shouldn't have main functions here. Especially since in the example linked, it clearly states that the main function will be replaced later. We should show them the proper way to register a resource creator in this example

Copy link
Member Author

@purplenicole730 purplenicole730 Aug 22, 2023

Choose a reason for hiding this comment

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

This is an intermediary step, so we're showing what it looks like right after registering the resource in the registry. @dannenberg requested to have snapshots in the middle of the steps so that a user can easily follow along.
As for the main function, it was originally not here until another PR added a main() function. It does say in the descriptions that whatever is in the main can also be its own file.

Copy link
Member Author

Choose a reason for hiding this comment

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

@purplenicole730 purplenicole730 requested a review from njooma August 22, 2023 16:52
@purplenicole730 purplenicole730 requested a review from cheukt August 25, 2023 18:13
Copy link
Member

@cheukt cheukt left a comment

Choose a reason for hiding this comment

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

LGTM

@purplenicole730 purplenicole730 merged commit 4ccdc1b into viamrobotics:main Aug 29, 2023
@purplenicole730 purplenicole730 deleted the RSDK-4172-update-wifi-sensor branch August 29, 2023 15:31
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.

4 participants