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

[wip] Fix duplicate scenes in Solution.msg in forward planning #639

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
[test] duplicate scenes in Solution.msg
captain-yoshi committed Dec 14, 2024
commit 904020fda305413683a974d0f318896db6622598
1 change: 1 addition & 0 deletions core/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ if (CATKIN_ENABLE_TESTING)
mtc_add_gmock(test_pruning.cpp)
mtc_add_gtest(test_properties.cpp)
mtc_add_gtest(test_cost_terms.cpp)
mtc_add_gtest(test_storage.cpp)

mtc_add_gmock(test_fallback.cpp)
mtc_add_gmock(test_cost_queue.cpp)
35 changes: 35 additions & 0 deletions core/test/test_storage.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "models.h"

#include <moveit/task_constructor/task.h>
#include <moveit/task_constructor/stages/fixed_state.h>

#include <moveit/planning_scene/planning_scene.h>

#include <ros/console.h>
#include <gtest/gtest.h>

using namespace moveit::task_constructor;
using namespace planning_scene;
using namespace moveit::core;

// https://github.com/moveit/moveit_task_constructor/issues/638
TEST(SolutionMsg, DuplicateScenes) {
Task t;
PlanningScenePtr scene;

t.setRobotModel(getModel());
scene = std::make_shared<PlanningScene>(t.getRobotModel());
t.add(std::make_unique<stages::FixedState>("start", scene));

EXPECT_TRUE(t.plan(1));
EXPECT_EQ(t.solutions().size(), 1u);

// create solution
moveit_task_constructor_msgs::Solution solution_msg;
t.solutions().front()->toMsg(solution_msg);

// all sub trajectories `scene_diff` should be a diff
EXPECT_EQ(solution_msg.sub_trajectory.size(), 1u);
EXPECT_EQ(solution_msg.start_scene.is_diff, false);
EXPECT_EQ(solution_msg.sub_trajectory.front().scene_diff.is_diff, true);
}