-
Notifications
You must be signed in to change notification settings - Fork 195
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 type hints to tf2_ros_py code(#275) #315
Conversation
@clalancette Hi, can you take a look at the PR for adding to type hints to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks generally good to me, so I'd encourage you to continue on and do the rest of the files as well. I wouldn't bother doing a separate commit per-file; we are probably going to squash-merge it at the end anyway. Thanks for the work so far!
@clalancette @sloretz This is ready for review.
Separately:
If yes, I will create a new PR for 1 & 2 and fix the tests if required. |
@surfertas Thanks for the work so far. This PR a little hard to review at the moment because it contains changes from other PRs as well. If you rebase this onto the latest ros2 branch, it will have just the changes from you. Then I'll take a look at answering your other questions. Thanks. |
@clalancette Apologies and no problem. You should now only see the changes from me. Thank you. |
…ometry2 into surfertas/typehints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got a lot of comments inline, but they are all easy to fix and most of them are of the same type. So it should be pretty easy to fix them.
To comment on your other questions:
The constructor for StaticTransformBroadcaster and TransformListener both have qos as an Optional[Union[QoSProfile, int]] type and handle None while TransformBroadcaster has qos not as an Optional and does not handle the None case and does not raise a type error if None is passed inadvertently. Should this be handled?
Yeah, it should be handled. I'd change the TransformBroadcaster
to take a None
by default, and then have the code construct the proper QoS object if it is None. That makes it similar to the other two.
Should time be changed to time.to_msg() constistent with lookup_transform_full() and the signature?
Sorry, I don't understand this question. Can you expand on it a little more?
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Co-authored-by: Chris Lalancette <clalancette@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think this looks great. Thanks for taking this on @surfertas . There are 3 open items here:
- We still don't have a resolution on
kwargs
forset_transform
. - We should fix TransformBroadcaster to have a
None
qos by default, and construct the object inside of the method (like we do withStaticTransformBroadcaster
andTransformListener
. - We need to fix up
lookup_transform
to take the right type in.
However, all of these can be left as follow-up tasks. @surfertas could you please open up issues for all 3 of the above items? Once that is done, I'm happy to approve and run CI on this.
@clalancette three separate issues created. Separately, are there any plans to integrate stubs? Ultimately, will allow users of the library to type check their code. |
Fantastic, thanks.
I don't think we've considered it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for all of the work here. I'll run CI on it next.
@surfertas Tests are failing, probably because you need a |
@clalancette Has been added. |
Thanks. Here's another CI try: |
Looks happy, I'm going to go ahead and merge this. Thanks again for the contribution. |
tf2_ros_py
.:rtypes
annotations from docstring.TypeVar()
to define types for LookupTransformGoal and LookupTransformResult.