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

fix Timers not being invoked when using ActionClients or ActionServer within the same node #130

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions rcldotnet/RCLdotnet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,17 @@ public static void SpinOnce(Node node, long timeout)
WaitSetAddGuardCondition(waitSetHandle, guardCondition.Handle);
}

foreach (var timer in node.Timers)
{
WaitSetAddTimer(waitSetHandle, timer.Handle);
}

// Action clients and servers need to be registerd after all the
// others that are handled by
// RCLdotnetDelegates.native_rcl_wait_set_*_ready methods, as
// they track indexes of the given waitables. Adding action
// clients and action servers before will get those indexes
// mixed up.
foreach (var actionClient in node.ActionClients)
{
WaitSetAddActionClient(waitSetHandle, actionClient.Handle);
Expand All @@ -1231,11 +1242,6 @@ public static void SpinOnce(Node node, long timeout)
WaitSetAddActionServer(waitSetHandle, actionServer.Handle);
}

foreach (var timer in node.Timers)
{
WaitSetAddTimer(waitSetHandle, timer.Handle);
}

bool ready = Wait(waitSetHandle, timeout);
if (!ready)
{
Expand Down
Loading