-
Notifications
You must be signed in to change notification settings - Fork 173
Test cases for Fallbacks container #280
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
Changes from all commits
f2b12f1
f47f9c2
b98ee7f
514021c
414964a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ void append(ContainerBase& c, const std::initializer_list<StageType>& types) { | |
| } | ||
| } | ||
| } | ||
| constexpr double INF = std::numeric_limits<double>::infinity(); | ||
|
|
||
| class NamedStage : public GeneratorMockup | ||
| { | ||
|
|
@@ -685,3 +686,54 @@ TEST(Fallback, failing) { | |
| EXPECT_FALSE(t.plan()); | ||
| EXPECT_EQ(t.solutions().size(), 0u); | ||
| } | ||
|
|
||
| TEST(Fallback, DISABLED_ConnectStageInsideFallbacks) { | ||
| resetMockupIds(); | ||
| Task t; | ||
| t.setRobotModel(getModel()); | ||
|
|
||
| t.add(std::make_unique<GeneratorMockup>()); | ||
|
|
||
| auto fallbacks = std::make_unique<Fallbacks>("Fallbacks"); | ||
| fallbacks->add(std::make_unique<ConnectMockup>()); | ||
| t.add(std::move(fallbacks)); | ||
|
|
||
| t.add(std::make_unique<GeneratorMockup>()); | ||
|
|
||
| EXPECT_TRUE(t.plan()); | ||
| EXPECT_EQ(t.numSolutions(), 1u); | ||
| } | ||
|
|
||
| TEST(Fallback, ComputeFirstSuccessfulStageOnly) { | ||
| resetMockupIds(); | ||
| Task t; | ||
| t.setRobotModel(getModel()); | ||
|
|
||
| t.add(std::make_unique<GeneratorMockup>()); | ||
|
|
||
| auto fallbacks = std::make_unique<Fallbacks>("Fallbacks"); | ||
| fallbacks->add(std::make_unique<ForwardMockup>(PredefinedCosts::constant(0.0))); | ||
| fallbacks->add(std::make_unique<ForwardMockup>(PredefinedCosts::constant(0.0))); | ||
| t.add(std::move(fallbacks)); | ||
|
|
||
| EXPECT_TRUE(t.plan()); | ||
| EXPECT_EQ(t.numSolutions(), 1u); | ||
| } | ||
|
|
||
| TEST(Fallback, ActiveChildReset) { | ||
| resetMockupIds(); | ||
| Task t; | ||
| t.setRobotModel(getModel()); | ||
|
|
||
| t.add(std::make_unique<GeneratorMockup>(PredefinedCosts{ { 0.0, INF, 0.0 } })); | ||
|
|
||
| auto fallbacks = std::make_unique<Fallbacks>("Fallbacks"); | ||
| fallbacks->add(std::make_unique<ForwardMockup>(PredefinedCosts::constant(0.0))); | ||
| fallbacks->add(std::make_unique<ForwardMockup>(PredefinedCosts::constant(0.0))); | ||
| auto first = fallbacks->findChild("FWD1"); | ||
| t.add(std::move(fallbacks)); | ||
|
|
||
| EXPECT_TRUE(t.plan()); | ||
| EXPECT_EQ(t.numSolutions(), 2u); | ||
| EXPECT_EQ(first->solutions().size(), 2u); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we agree on how this test should behave. That's good. :) However, this only succeeds because of https://github.com/ros-planning/moveit_task_constructor/pull/280/files#diff-5b0930974b77eab73f48b74214a60ac0562cd2a110285279bb5ad1094b40a842R822 now (Robert fixes the active child as soon as it produced any solution, even if it can't compute in between). As I do not agree with this patch we are not done here yet. |
||
| } | ||
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.
This patch does not make any sense to me.
If the generator in ComputeFirstSuccessfulStageOnly would spawn multiple solutions, I would still expect a solution from the first child for each of the inputs! Otherwise you prune too many computation branches and loose solutions.