|
4 | 4 | #include <moveit/task_constructor/stages/move_relative.h> |
5 | 5 | #include <moveit/task_constructor/stages/fixed_state.h> |
6 | 6 | #include <moveit/task_constructor/solvers/cartesian_path.h> |
| 7 | +#include <moveit/task_constructor/solvers/joint_interpolation.h> |
7 | 8 | #include <moveit/task_constructor/solvers/pipeline_planner.h> |
8 | 9 |
|
9 | 10 | #include <moveit/planning_scene/planning_scene.h> |
@@ -32,6 +33,10 @@ solvers::CartesianPathPtr create<solvers::CartesianPath>() { |
32 | 33 | return std::make_shared<solvers::CartesianPath>(); |
33 | 34 | } |
34 | 35 | template <> |
| 36 | +solvers::JointInterpolationPlannerPtr create<solvers::JointInterpolationPlanner>() { |
| 37 | + return std::make_shared<solvers::JointInterpolationPlanner>(); |
| 38 | +} |
| 39 | +template <> |
35 | 40 | solvers::PipelinePlannerPtr create<solvers::PipelinePlanner>() { |
36 | 41 | auto p = std::make_shared<solvers::PipelinePlanner>("pilz_industrial_motion_planner"); |
37 | 42 | p->setPlannerId("LIN"); |
@@ -68,6 +73,7 @@ struct PandaMoveRelative : public testing::Test |
68 | 73 | } |
69 | 74 | }; |
70 | 75 | using PandaMoveRelativeCartesian = PandaMoveRelative<solvers::CartesianPath>; |
| 76 | +using PandaMoveRelativeJoint = PandaMoveRelative<solvers::JointInterpolationPlanner>; |
71 | 77 |
|
72 | 78 | moveit_msgs::CollisionObject createObject(const std::string& id, const geometry_msgs::Pose& pose) { |
73 | 79 | moveit_msgs::CollisionObject co; |
@@ -163,6 +169,25 @@ TEST_F(PandaMoveRelativeCartesian, cartesianRotateAttachedIKFrame) { |
163 | 169 | EXPECT_CONST_POSITION(move->solutions().front(), attached_object); |
164 | 170 | } |
165 | 171 |
|
| 172 | +// https://github.com/moveit/moveit_task_constructor/issues/664 |
| 173 | +TEST_F(PandaMoveRelativeJoint, jointOutsideBound) { |
| 174 | + // move joint inside limit |
| 175 | + auto initial_jpos = scene->getCurrentState().getJointPositions("panda_joint7"); |
| 176 | + move->setDirection([initial_jpos] { |
| 177 | + return std::map<std::string, double>{ { "panda_joint7", 2.0 - *initial_jpos } }; |
| 178 | + }()); |
| 179 | + EXPECT_TRUE(this->t.plan()) << "Plan should succeed, joint inside limit"; |
| 180 | + |
| 181 | + this->t.reset(); |
| 182 | + |
| 183 | + // move joint outside limit: 2.8973 |
| 184 | + move->setDirection([initial_jpos] { |
| 185 | + return std::map<std::string, double>{ { "panda_joint7", 3.0 - *initial_jpos } }; |
| 186 | + }()); |
| 187 | + |
| 188 | + EXPECT_FALSE(this->t.plan()) << "Plan should fail, joint outside limit"; |
| 189 | +} |
| 190 | + |
166 | 191 | using PlannerTypes = ::testing::Types<solvers::CartesianPath, solvers::PipelinePlanner>; |
167 | 192 | TYPED_TEST_SUITE(PandaMoveRelative, PlannerTypes); |
168 | 193 | TYPED_TEST(PandaMoveRelative, cartesianCollisionMinMaxDistance) { |
|
0 commit comments