|
1 | 1 | #include <moveit/task_constructor/container_p.h> |
2 | 2 | #include <moveit/task_constructor/stage_p.h> |
3 | 3 | #include <moveit/task_constructor/task_p.h> |
| 4 | +#include <moveit/task_constructor/solvers/joint_interpolation.h> |
4 | 5 | #include <moveit/task_constructor/stages/fixed_state.h> |
| 6 | +#include <moveit/task_constructor/stages/move_to.h> |
5 | 7 | #include <moveit/planning_scene/planning_scene.hpp> |
6 | 8 |
|
7 | 9 | #include "stage_mockups.h" |
@@ -717,3 +719,32 @@ TEST_F(TaskTestBase, preempt) { |
717 | 719 | EXPECT_EQ(fwd2->runs_, 0u); |
718 | 720 | EXPECT_TRUE(t.plan(1)); // make sure the preempt request has been resetted on the previous call to plan() |
719 | 721 | } |
| 722 | + |
| 723 | +TEST(Merger, empty) { |
| 724 | + Task task; |
| 725 | + task.setRobotModel(getModel()); |
| 726 | + |
| 727 | + auto scene = std::make_shared<planning_scene::PlanningScene>(task.getRobotModel()); |
| 728 | + auto& state = scene->getCurrentStateNonConst(); |
| 729 | + state.setToDefaultValues(); |
| 730 | + |
| 731 | + auto initial = std::make_unique<stages::FixedState>(); |
| 732 | + initial->setState(scene); |
| 733 | + task.add(std::move(initial)); |
| 734 | + |
| 735 | + auto planner = std::make_shared<solvers::JointInterpolationPlanner>(); |
| 736 | + |
| 737 | + auto merger = std::make_unique<Merger>("all init moves"); |
| 738 | + auto stage = std::make_unique<stages::MoveTo>("gripper", planner); |
| 739 | + stage->setGroup("eef_group"); |
| 740 | + stage->setGoal({ { "link2-tip-joint", state.getVariablePosition("link2-tip-joint") } }); |
| 741 | + merger->add(std::move(stage)); |
| 742 | + |
| 743 | + stage = std::make_unique<stages::MoveTo>("arm", planner); |
| 744 | + stage->setGroup("group"); |
| 745 | + stage->setGoal({ { "base-link1-joint", 1.0 } }); |
| 746 | + merger->add(std::move(stage)); |
| 747 | + |
| 748 | + task.add(std::move(merger)); |
| 749 | + EXPECT_TRUE(task.plan()); |
| 750 | +} |
0 commit comments