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 loss of first waypoint in upsample trajectory #416

Merged
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ void UpsampleTrajectoryTask::upsample(CompositeInstruction& composite,
if (start_instruction.isNull())
{
start_instruction = i.as<MoveInstructionPoly>();
composite.push_back(i); // Prevents loss of very first waypoint when upsampling
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerUpsampleTrajectoryTaskTest
EXPECT_EQ(node_info->isAborted(), false);
EXPECT_EQ(context->isAborted(), false);
EXPECT_EQ(context->isSuccessful(), true);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 17);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 18);
EXPECT_TRUE(context->task_infos.getAbortingNode().is_nil());
}

Expand Down Expand Up @@ -1736,7 +1736,7 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerIterativeSplineParameteriz
UpsampleTrajectoryTask task("abc", "input_data", "output_data", true);
EXPECT_EQ(task.run(*context), 1);
data->setData("input_data", context->data_storage->getData("output_data"));
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 17);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 18);
}
auto profiles = std::make_shared<ProfileDictionary>();
auto problem = std::make_unique<PlanningTaskComposerProblem>(env_, manip_, profiles, "abc");
Expand All @@ -1750,7 +1750,7 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerIterativeSplineParameteriz
EXPECT_EQ(node_info->isAborted(), false);
EXPECT_EQ(context->isAborted(), false);
EXPECT_EQ(context->isSuccessful(), true);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 17);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 18);
EXPECT_TRUE(context->task_infos.getAbortingNode().is_nil());
}

Expand Down Expand Up @@ -1874,7 +1874,7 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerTimeOptimalParameterizatio
UpsampleTrajectoryTask task("abc", "input_data", "output_data", true);
EXPECT_EQ(task.run(*context), 1);
data->setData("input_data", context->data_storage->getData("output_data"));
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 17);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 18);
}
auto profiles = std::make_shared<ProfileDictionary>();
auto problem = std::make_unique<PlanningTaskComposerProblem>(env_, manip_, profiles, "abc");
Expand All @@ -1888,7 +1888,7 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerTimeOptimalParameterizatio
EXPECT_EQ(node_info->isAborted(), false);
EXPECT_EQ(context->isAborted(), false);
EXPECT_EQ(context->isSuccessful(), true);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 17);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 18);
EXPECT_TRUE(context->task_infos.getAbortingNode().is_nil());

// Serialization
Expand Down Expand Up @@ -2015,7 +2015,7 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerRuckigTrajectorySmoothingT
auto context = std::make_unique<TaskComposerContext>(std::move(problem), std::move(data2));
UpsampleTrajectoryTask task("abc", "input_data", "output_data", true);
EXPECT_EQ(task.run(*context), 1);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 17);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 18);

auto data3 = std::make_unique<TaskComposerDataStorage>();
data3->setData("input_data", context->data_storage->getData("output_data"));
Expand All @@ -2024,7 +2024,7 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerRuckigTrajectorySmoothingT
TimeOptimalParameterizationTask task2("abc", "input_data", "output_data", true);
EXPECT_EQ(task2.run(*context2), 1);
data->setData("input_data", context2->data_storage->getData("output_data"));
EXPECT_EQ(context2->data_storage->getData("output_data").as<CompositeInstruction>().size(), 17);
EXPECT_EQ(context2->data_storage->getData("output_data").as<CompositeInstruction>().size(), 18);
}
auto profiles = std::make_shared<ProfileDictionary>();
auto problem = std::make_unique<PlanningTaskComposerProblem>(env_, manip_, profiles, "abc");
Expand All @@ -2038,7 +2038,7 @@ TEST_F(TesseractTaskComposerPlanningUnit, TaskComposerRuckigTrajectorySmoothingT
EXPECT_EQ(node_info->isAborted(), false);
EXPECT_EQ(context->isAborted(), false);
EXPECT_EQ(context->isSuccessful(), true);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 17);
EXPECT_EQ(context->data_storage->getData("output_data").as<CompositeInstruction>().size(), 18);
EXPECT_TRUE(context->task_infos.getAbortingNode().is_nil());
}

Expand Down
Loading