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

Update graph API documentation. #272

Merged
merged 4 commits into from
Sep 24, 2020
Merged

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Sep 11, 2020

Precisely what the title says. First pass.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
* the effects of starvation due to OS scheduling).
*
* \par Thread-safety
* Nodes are thread-safe objects, and so are all operations on them except for finalization.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to come up with a way to document object thread-safety and not just that of functions. This is way more duplication I'm comfortable with.

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to come up with a way to document object thread-safety and not just that of functions.

This is something of a philosophical debate, honestly. In some sense, there is no such thing as a thread-safe object; thread safety only comes into play when accessing data, and that can only be done through functions or methods.

I think your main concern here is the duplication of this paragraph down below. It seems to me that that can mostly be resolved by pointing the reader to the documentation about the node API, which presumably talks about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is something of a philosophical debate, honestly. In some sense, there is no such thing as a thread-safe object; thread safety only comes into play when accessing data, and that can only be done through functions or methods.

Sure, but what is an object if not state (data) coupled with behavior (functions)? At any rate, I think ros2/ros2#1004 would benefit from your POV.

It seems to me that that can mostly be resolved by pointing the reader to the documentation about the node API, which presumably talks about that.

Do we have node API documentation? Or are you talking about something that we should have at some point?

Copy link
Member

Choose a reason for hiding this comment

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

We can have higher level sections in doxygen (using the file for example), or we can document the struct, like I do with context:

https://github.com/ros2/rcl/blob/8bcada7b884693644d7ba2e3bd2c22fd9541eba7/rcl/include/rcl/context.h#L43-L143

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any objections to proceed without relocating documentation? For the sake of speed, and to keep it consistent with previous API spec updates that do things this way.

Copy link
Member

Choose a reason for hiding this comment

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

Fine with me.

* <i>[1] rmw implementation defined, check the implementation documentation</i>
*
* \par Runtime behavior
* To query the ROS graph is a synchronous operation.
Copy link
Contributor Author

@hidmic hidmic Sep 11, 2020

Choose a reason for hiding this comment

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

We need to come up with a way to document whole features and abstractions/concepts like the ROS graph.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. Two places I can think to put it:

  1. In a doc subdirectory at the top-level of this repository. That's nice in that it keeps it close to where it is "defined", but it also buries the concept down in an essentially "detail" package.
  2. At index.ros.org or docs.ros2.org .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd be inclined towards having it here, in this repository, close to the API specifications that rely on it. External web sites can then consume that content.

Copy link
Member

Choose a reason for hiding this comment

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

I think here is fine, but it depends on the purpose. If it is to make this API clear, then here, but it's goal is to explain the concept to users, then higher up the stack is more appropriate, but some details will not, like the thread-safety of this API, as an example. Because higher level APIs may give different thread-safety guarantees and the users are more likely to use those interfaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it is to make this API clear, then here, but it's goal is to explain the concept to users, then higher up the stack is more appropriate

Hmm, higher up the stack where? IMHO we cannot use terms and concepts in API documentation without an explanation or a link to an explanation. Besides, isn't the ROS middleware interface the best place to introduce ROS middleware concepts (barring tutorials and conceptual overviews that we can have elsewhere for educational purposes)?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I was just saying that tutorials and conceptual guides (things actual users will need) shouldn't depend on this except obliquely.

rmw/include/rmw/rmw.h Outdated Show resolved Hide resolved
rmw/include/rmw/rmw.h Outdated Show resolved Hide resolved
@@ -24,8 +24,9 @@ extern "C"
#include "rmw/types.h"
#include "rmw/visibility_control.h"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These APIs expect the same allocator to be passed around to not hit UB, presumably to spare storage. I wonder if these shouldn't be explicitly tagged for internal implementation use only.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, documentation duplication makes me cry.

Copy link
Member

Choose a reason for hiding this comment

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

They really should store the allocator given during init and reuse it during fini rather than having the user pass it...

Copy link
Member

Choose a reason for hiding this comment

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

That is to say, I agree with you.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Copy link
Contributor

@clalancette clalancette left a 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 bunch of comments in here.

I think there are 2 major things that this has pointed out.

The first is that there is a lot of duplication in the comments. Partly this is because the API could be improved. One example is rmw_get_node_names() and rmw_get_node_names_with_enclaves(). In my opinion, there is no reason to have both of those APIs. Instead we could have rmw_get_node_names take an enclave argument, and don't attempt to fill in enclave information if it is NULL. Partly the duplication is because we are missing some place to point to that has higher-level documentation about concepts.

The second major point is that we need a place to put higher-level documentation about concepts. My first inclination would be to start putting some conceptual documents at https://index.ros.org/doc/ros2/Tutorials/ or http://docs.ros2.org/foxy/ , but I'm not sure.

I honestly think neither is blocking; I would go with duplication for now, and we can review both of them later. But if we do that, then we should open up issues and/or add roadmap items to do so.

* <i>[1] rmw implementation defined, check the implementation documentation</i>
*
* \par Runtime behavior
* To query the ROS graph is a synchronous operation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. Two places I can think to put it:

  1. In a doc subdirectory at the top-level of this repository. That's nice in that it keeps it close to where it is "defined", but it also buries the concept down in an essentially "detail" package.
  2. At index.ros.org or docs.ros2.org .

* the effects of starvation due to OS scheduling).
*
* \par Thread-safety
* Nodes are thread-safe objects, and so are all operations on them except for finalization.
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to come up with a way to document object thread-safety and not just that of functions.

This is something of a philosophical debate, honestly. In some sense, there is no such thing as a thread-safe object; thread safety only comes into play when accessing data, and that can only be done through functions or methods.

I think your main concern here is the duplication of this paragraph down below. It seems to me that that can mostly be resolved by pointing the reader to the documentation about the node API, which presumably talks about that.

rmw/include/rmw/get_node_info_and_types.h Outdated Show resolved Hide resolved
rmw/include/rmw/get_node_info_and_types.h Outdated Show resolved Hide resolved
rmw/include/rmw/get_node_info_and_types.h Outdated Show resolved Hide resolved
rmw/include/rmw/rmw.h Outdated Show resolved Hide resolved
rmw/include/rmw/rmw.h Outdated Show resolved Hide resolved
rmw/include/rmw/rmw.h Outdated Show resolved Hide resolved
rmw/include/rmw/topic_endpoint_info.h Outdated Show resolved Hide resolved
rmw/include/rmw/topic_endpoint_info.h Outdated Show resolved Hide resolved
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Sep 14, 2020

Comments addressed, PTAL!

@gbiggs
Copy link
Member

gbiggs commented Sep 17, 2020

@clalancette Regarding writing a higher level concepts document, "write a tutorial on how to write an RMW implementation" is one of the outputs we planned for the Zenoh work. I'm happy to help out with writing the higher-level concepts document, provided someone with more experience with the API is willing to review it in detail.

@hidmic
Copy link
Contributor Author

hidmic commented Sep 18, 2020

FYI I'll start writing tests and adapting implementation to comply with this. We can sort out where to put documentation later on.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm, it's a great improvement!

I commented on most of the conversations, but you guys picked out everything I noticed already, so no extra stuff from me I think.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Sep 24, 2020

Alright, going in!

@hidmic hidmic merged commit 7b82413 into master Sep 24, 2020
@delete-merged-branch delete-merged-branch bot deleted the hidmic/update-graph-api-docs branch September 24, 2020 18:25
ahcorde pushed a commit that referenced this pull request Oct 13, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
ahcorde pushed a commit that referenced this pull request Oct 13, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
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