Skip to content

Commit

Permalink
fix Timers not being invoked when using ActionClients or ActionServer…
Browse files Browse the repository at this point in the history
…s within the same node
  • Loading branch information
hofmannmarkus0 committed Apr 11, 2024
1 parent 40adb43 commit 84aa569
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions rcldotnet/RCLdotnet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,14 @@ public static void SpinOnce(Node node, long timeout)
WaitSetAddGuardCondition(waitSetHandle, guardCondition.Handle);
}

// Add timers to WaitSet before action clients and servers.
// As ActionClient and ActionServer also register timers internally,
// the order of adding them to the WaitSet has to match the execution order
foreach (var timer in node.Timers)
{
WaitSetAddTimer(waitSetHandle, timer.Handle);
}

foreach (var actionClient in node.ActionClients)
{
WaitSetAddActionClient(waitSetHandle, actionClient.Handle);
Expand All @@ -1231,11 +1239,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

0 comments on commit 84aa569

Please sign in to comment.