Skip to content

Queue behaviour#58

Merged
dorkamotorka merged 39 commits intokinetic-develfrom
queue-behaviour
Aug 12, 2020
Merged

Queue behaviour#58
dorkamotorka merged 39 commits intokinetic-develfrom
queue-behaviour

Conversation

@dorkamotorka
Copy link
Copy Markdown
Contributor

No description provided.

@dorkamotorka dorkamotorka requested a review from rohbotics July 28, 2020 18:46
@dorkamotorka
Copy link
Copy Markdown
Contributor Author

dorkamotorka commented Jul 28, 2020

goalCancelling test fixture is not working properly yet.

ASSERT_EQ(3.0, received_goal->target_pose.pose.position.x);

// Cancelling the first goal - PITFALL
resumeExecuting();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should resume after you sent the cancel, that way the code in the callback has a chance to check for preempts and stuff again.

Comment thread test/test_goal_queueing.cpp Outdated
ASSERT_TRUE(got_goal);
ASSERT_EQ(7.0, received_goal->target_pose.pose.position.x);

// Third goal
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This part seems reasonable

Comment thread test/test_goal_queueing.cpp Outdated
finishExecuting(); // Finish the 3nd goal
/*
- if another goal is received add it to the queue (DONE)
- if the queue full, set the current goal as preempted - explicitly called! - so cancelling the current goal and start executing the next one
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We decided to change this behavior. If the queue is full, the last goal in the queue will be canceled and replaced with the new goal.

Copy link
Copy Markdown
Member

@rohbotics rohbotics left a comment

Choose a reason for hiding this comment

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

Thanks, overall the tests look good, but all the sleeps make me nervous, because it means the tests are timing sensitive and might randomly fail. I ran the tests 10 times, and I had at least 3 random failures.

I think with more signalling condition variables we can significantly increase the reliability of the tests.

  1. We should have a signal that goes off at the beginning of executeCallback then we can have a helper function that waits for that signal to go off instead of just doing a sleep.

  2. resumeExecuting needs to wait for one loop of the executeCallback to complete so that the test variables actually have a chance to update.

Can you implement that?

@dorkamotorka
Copy link
Copy Markdown
Contributor Author

Yes, I will work on it.

@dorkamotorka
Copy link
Copy Markdown
Contributor Author

So despite removing the sleep functions and adding Helper function, unit testing succed in 7/10 cases. Before moving on to ASSERT-ing variables I want to make sure where am I missing things, that the test is so unreliable.

@dorkamotorka
Copy link
Copy Markdown
Contributor Author

dorkamotorka commented Aug 3, 2020

The test fixtures are working consistently but lagging a lot due to sleep() that cancelGoal and everything else required to work properly. Tests are time independent, sleep are there just so the threads have enough time to close.

Comment thread test/test_goal_queueing.cpp Outdated
resumeExecuting();
updateExecuting();
sleepExecuting();
EXPECT_TRUE(goal_preempted);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tested this 10 times, this is the only line that failed (failed 3 times). Can you put a 0.5 second sleep before it as a quick fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Weird, never failed in my case. Yes, sure.

@dorkamotorka dorkamotorka merged commit e88ccab into kinetic-devel Aug 12, 2020
@dorkamotorka dorkamotorka deleted the queue-behaviour branch August 12, 2020 06:02
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.

2 participants