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

Waitset timestamp fields #591

Closed
wants to merge 19 commits into from
Closed

Waitset timestamp fields #591

wants to merge 19 commits into from

Conversation

iluetkeb
Copy link
Contributor

@iluetkeb iluetkeb commented Mar 10, 2020

Both the standard wait_set and internal structures got the timestamps.
Currently, the fields are not used.

Also see ros2/rmw#200

@iluetkeb
Copy link
Contributor Author

@dirk-thomas @wjwwood are you generally okay with the field additions to the existing structs? if yes, I could proceed with further work that's actually using them.

@iluetkeb iluetkeb changed the title Added timestamp fields. Waitset timestamp fields Mar 10, 2020
@iluetkeb
Copy link
Contributor Author

Hey @JaimeMartin @MiguelCompany this is the start of timestamp information in rmw/rcl. It is intended that these fields are filled by the middleware with the arrival timestamp of messages. I would like to start a discussion with you guys on how to best provide this information.

@ralph-lange
Copy link

Connects to ros2/design#259.

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.

I had a few style nitpicks, but otherwise lgtm.

We should consider any necessary updates to the tests and documentation as well.

rcl/include/rcl/wait.h Outdated Show resolved Hide resolved
rcl/include/rcl/wait.h Show resolved Hide resolved
@iluetkeb iluetkeb mentioned this pull request Mar 13, 2020
3 tasks
@MiguelCompany
Copy link
Contributor

Hey @JaimeMartin @MiguelCompany this is the start of timestamp information in rmw/rcl. It is intended that these fields are filled by the middleware with the arrival timestamp of messages. I would like to start a discussion with you guys on how to best provide this information.

Would it be enough to have a get_first_unread_sample_info on the subscribers that could be called from rmw_wait when necessary?

@iluetkeb
Copy link
Contributor Author

Would it be enough to have a get_first_unread_sample_info on the subscribers that could be called from rmw_wait when necessary?

That should work and would probably provide the most accurate information, however we are a bit concerned about performance. Reading the sample info seems like it would require deserialization. Also, since one of the other things we have identified is that we might potentially need to call rmw_wait more often, we should keep this as performant as possible.

One other idea I had is that you could keep the listener attached to the objects across calls to wait, and then store the current time within the callback that gets notified upon changes. This would likely incur almost no overhead and still provide good-enough information.

@iluetkeb
Copy link
Contributor Author

We should consider any necessary updates to the tests and documentation as well.

As said in ros2/rmw#200, I think we need to test everything in rcl, since it does the relevant work.

However, in test_wait.cpp, I do not see any tests which are checking the pre-existing fields. For example, in wait_set_is_valid, there is no looking at the actual contents of the wait_set. Similarly, there is a test test_resize_to_zero, which looks at the counts but not the arrays inside the wait_set.

@wjwwood is that intentionally? I mean, I'd be happy to add a test for the contents, but I'm wondering what the current lack of such tests should tell me.

@wjwwood
Copy link
Member

wjwwood commented Mar 19, 2020

@wjwwood is that intentionally? I mean, I'd be happy to add a test for the contents, but I'm wondering what the current lack of such tests should tell me.

I don't think it is intentional, but wait_set_is_valid was added recently. I think @jacobperron added it in this pr #538, but I can't tell just from the context if that's intentional or an oversight.

@jacobperron
Copy link
Member

For the test I added, I'm fairly certain I just copied one of the existing tests and modified it minimally to exercise the API I added.

@iluetkeb
Copy link
Contributor Author

Alright, @wjwwood @jacobperron thanks for the info. I'll add a test looking at all the fields, then.

@iluetkeb iluetkeb marked this pull request as ready for review March 20, 2020 20:32
rcl/include/rcl/wait.h Show resolved Hide resolved
rcl/src/rcl/wait.c Outdated Show resolved Hide resolved
rcl/src/rcl/wait.c Outdated Show resolved Hide resolved
rcl/src/rcl/wait.c Outdated Show resolved Hide resolved
rcl/src/rcl/wait.c Outdated Show resolved Hide resolved
rcl/src/rcl/wait.c Show resolved Hide resolved
rcl/test/CMakeLists.txt Outdated Show resolved Hide resolved
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 other than nitpicks

rcl/test/CMakeLists.txt Outdated Show resolved Hide resolved
rcl/test/CMakeLists.txt Outdated Show resolved Hide resolved
@iluetkeb
Copy link
Contributor Author

iluetkeb commented Apr 2, 2020

Alright folks, this now has a test for presence of timestamps, and in ros2/rmw_fastrtps#359 we have an implementation of timestamps for subscriptions, clients and services that passes the test.

Both the standard wait_set and internal structures got the timestamps.
Currently, the fields are not used.

Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
…ebohle Ingo (CR/AEX3) <[email protected]>

Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
@Karsten1987
Copy link
Contributor

Karsten1987 commented Apr 8, 2020

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@Karsten1987
Copy link
Contributor

@iluetkeb ironically, I don't have access to the fork of boschresearch, so I can't push a fix on your branch. I think what's missing here is the following:

diff --git a/rcl/test/CMakeLists.txt b/rcl/test/CMakeLists.txt
index fb31b27..470337f 100644
--- a/rcl/test/CMakeLists.txt
+++ b/rcl/test/CMakeLists.txt
@@ -219,7 +219,7 @@ function(test_target_function)
     ENV ${rmw_implementation_env_var}
     APPEND_LIBRARY_DIRS ${extra_lib_dirs}
     LIBRARIES ${PROJECT_NAME}
-    AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp"
+    AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
   )

   # This condition runs the timestmap test only when we know the RMW implementation

Signed-off-by: Luetkebohle Ingo (CR/AEX3) <[email protected]>
@iluetkeb
Copy link
Contributor Author

iluetkeb commented Apr 9, 2020

That include is not actually necessary, since I moved the relevant test to test_wait_set_timestamp.c. I'm wondering why it doesn't complain on my box, but anyway, it's removed now.

I also added you to the correct team for our forks.

@Karsten1987
Copy link
Contributor

Karsten1987 commented Apr 9, 2020

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@rotu
Copy link
Contributor

rotu commented Apr 9, 2020

I'm sorry I'm coming to this late. It seems like a bad idea, and I think should be strongly reconsidered. ros2/design#259 (comment)

@iluetkeb
Copy link
Contributor Author

iluetkeb commented Apr 9, 2020

@rotu I have commented in the design issue and I hope I could address your concerns.

It is a bit late now, in my case literally because I'm in Europe, where it's currently half past eight 😉 So I will log off after this comment, and tomorrow being Good Friday, I won't work. If you have further concerns, I can only contribute further on Saturday or (preferably) after Easter. Hope that's enough! Happy Holidays to you all.

@iluetkeb
Copy link
Contributor Author

Closed in favor of #619

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.

7 participants