-
Notifications
You must be signed in to change notification settings - Fork 163
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
Guard conditions: remove node from constructor, fix header #33
Conversation
@@ -129,7 +129,7 @@ TEST_F(CLASSNAME(TestSubscriptionFixture, RMW_IMPLEMENTATION), test_subscription | |||
// Process : test_subscription__rmw_opensplice_cpp <23524> | |||
// Thread : main thread 7fff7342d000 | |||
// Internals : V6.4.140407OSS///v_topicNew/v_topic.c/448/21/1455157023.781423000 | |||
const char * topic = "chatter_int64"; | |||
const char * topic = "rcl_test_subscription_nominal_chatter_int64"; |
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.
why this change in test topic? same in L188
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 changed the topic name to be more specific to avoid cross-talk. Most tests in the test_rclcpp package also follow this convention.
I rolled in another important change in 7bb5987: guard_condition.h declares a function "rcl_guard_condition_trigger", while guard_condition.c provides an implementation called "rcl_trigger_guard_condition". |
I think |
Either one is fine with me. I thought that class name first might be a convention in rcl (many init and fini functions follow the convention of |
Thanks for fixing that @jacquelinekay. I think the headers name is better, since it can only be called on a guard condition. It is the equivalent of a class method and so I think it is appropriate to namespace it as such. Also it follows the convention of the rest of the functions like init and fini. |
Well you've already changed it to match the c file, that's fine. Either is fine by me if only because it's otherwise so inconsistent. |
TODO: investigate if adding/removing conditions to waitset is necessary, and adding/removing conditions |
867e914
to
0023cd8
Compare
After some testing and discussion we've concluded that we don't actually need a distinction between fixed and non-fixed guard conditions. The set of PRs associated with this one does the following: Remove references to fixed guard conditions. Make sure all guard conditions get reset (trigger state set back to untriggered) after rmw_wait, so that they can retrigger on each call to wait. In rclcpp, add a guard condition to each node to wake up the waitset whenever a new waitable entity is added (this is for ros2/rclcpp#209). Currently guard conditions are attached to the waitset before wait and detached after wait. I believe that this is not necessary and the guard conditions could be attached the DDS waitset when associated with a waitset and detached on destruction (for example, when a node is removed from an executor, its notify guard condition should be detached from the waitset for that executor). I think the same may apply for the read conditions for subscriptions, services, and clients. However, in order to keep my changes modular, I will ticket this and address it later, possibly after the rcl/rclcpp refactor. |
As a historical note, I initially added the idea of fixed guard conditions here, to fix a segfault due to shared ownership of the global ctrl-C guard condition: But after running the same test that originally motivated the fixed guard conditions over 200 times using these branches, I've concluded that this segfault is no longer present. |
ROS 2 Jenkins is pretty quiet right now, so I'm running a job with |
If all guard conditions are always reset how will the following use case continue to work:
|
Subscriptions don't have guard conditions? They are read conditions. Only guard conditions are reset after each wake up. Subscriptions can only be "reset" when you take from them. |
I see. That makes sense then. Sorry for the noise. |
Apparently, I never hit send on this... wrote it like two days ago. So @jacquelinekay and I discussed this off-line and came to some conclusions. tl;dr We think the distinction between fixed and non-fixed guard conditions are not necessary anymore, but we're still a bit uncertain if the distinction is required in order to avoid attaching and detaching of guard conditions each loop of spin. Fixed Guard ConditionsFixed guard conditions exist to differentiate between guard conditions that should always be reset after waking up from Some guard conditions only purpose is to interrupt a blocking call to "Normal" Guard ConditionsOther guard conditions are never reset unless done so by the code outside of rmw. The are also detached and reattached in each call to We use to use these normal guard conditions to implement timers, such that each timer had a thread and a guard condition. In the thread the timers would wait for a period and then trigger the guard condition. This would prevent We would also probably need these normal guard conditions if we ever provided a general purpose guard condition to users via the client library API, e.g. in @jacquelinekay and I talked about how a user might use this functionality and decided that providing both What to doBased on the facts that we don't currently use any "normal" guard conditions in However, we still need to look at when and why we are attaching and detaching conditions of all kinds to the DDS wait sets, and so there might be a reason hiding there that may encourage us to instead keep the distinction between fixed and non-fixed guard conditions. Sorry for the long brain dump. |
0023cd8
to
ab5deb0
Compare
a61f9ba
to
655aa99
Compare
hm. I think this might introduce some flaky tests (gtest_executor for connext and fastrtps). |
8525402
to
b50ee33
Compare
b50ee33
to
cc6bce2
Compare
* add calloc and zero initialized allocator function * change string array to have proper init, hold allocator * fix rcutils_split's use of string array, for now * gitignore
While refactoring rclcpp to use rcl, I decided the guard conditions API had the following problems:
We shouldn't need to associate a guard condition with a node in its constructor or destructor.
The trigger function had a different name in the source and header files, causing a link error.
I'm also removing fixed guard conditions from the rmw API, so I'm changing the rmw functions called in the rcl code to reflect this.