Open captain-yoshi opened 3 years ago
Sorry for the late response.
Your code should "just work" but apparently it doesn't. This has nothing to do with any notion of "EndEffector" in the MoveGroupInterface code you quote.
It might actually be a bug in your planner configuration. Do you have have the ResolveConstraintFrames
adapter loaded in the planning pipeline?
My apologies. I made a mistake, the orientation constraint was not wrt the mesh. After the fix the planning solves correctly. But the console reports this errors on a successful solution for the connect stage:
[DEBUG] [1596556607.717987725]: Computing stage 'filtered'
[ INFO] [1596556607.719912078]: Planner configuration 'left_eef' will use planner 'geometric::RRTConnect'. Additional configuration parameters will be set when the planner is constructed.
[ INFO] [1596556607.720311533]: left_eef: Allocating specialized state sampler for state space
[ INFO] [1596556607.720422833]: left_eef/left_eef: Starting planning with 1 states already in datastructure
[ INFO] [1596556608.246790618]: left_eef/left_eef: Created 4 states (2 start + 2 goal)
[ INFO] [1596556608.246864900]: Solution found in 0.526790 seconds
[ INFO] [1596556608.450591070]: SimpleSetup: Path simplification took 0.203637 seconds and changed from 3 to 2 states
[ERROR] [1596556608.464468861]: Link 'cuvette' not found in model 'ur3_dual_eef'
[ WARN] [1596556608.464553573]: Could not find link model for link name cuvette
I guess that this is not really an error because a solution was found. But there are some solutions that does not respect the constraints. This happens when there appears to have multiple segments in one solution (See gif). I can open up another issue if you prefer.
The object cuvette
mesh has the same orientation frame as the frame id optical_table
(See pictures). Fixed code:
moveit_msgs::Constraints constraint;
constraint.name = "test";
Eigen::Quaterniond quat = Eigen::AngleAxisd(0, Eigen::Vector3d::UnitZ()) *
Eigen::AngleAxisd(0, Eigen::Vector3d::UnitY()) *
Eigen::AngleAxisd(0, Eigen::Vector3d::UnitX());
moveit_msgs::OrientationConstraint oc;
oc.header.frame_id = "optical_table";
oc.link_name = "cuvette"; // Object that is attached to the eef
oc.orientation.w = quat.w();
oc.orientation.x = quat.x();
oc.orientation.y = quat.y();
oc.orientation.z = quat.z();
oc.absolute_x_axis_tolerance = 0.4; // ~23 degrees
oc.absolute_y_axis_tolerance = 0.4; // ~23 degrees
oc.absolute_z_axis_tolerance = 2 * M_PI; // Represents the gravity axis (Pointing UP)
oc.weight = 100;
constraint.orientation_constraints.push_back(oc);
If this actually talks about oc.link_name
you are probably still missing the ResolveConstraintFrames
adapter.
To verify whether this is an MTC issue, try to reproduce this planning request in MoveIt (using the MoveGroupInterface).
I would expect it will fail as well (which would mean this is not an issue with MTC, but with your setup or MoveIt general).
Do you have have the ResolveConstraintFrames adapter loaded in the planning pipeline?
Yes I do!
If this actually talks about oc.link_name
The only place I see not found in model
when grepping the moveit repo is in the robot_model.cpp
file. There is a good chance that this is related to theoc.link_name
.
I would expect it will fail as well (which would mean this is not an issue with MTC, but with your setup or MoveIt general).
It does not fail with MTC. It gives good solutions. I will investigate this further and report back.
There is a good chance that this is related to the
oc.link_name
.
You can easily check by changing the string and observing the warning. :)
It does not fail with MTC. It gives good solutions. I will investigate this further and report back.
If it also generates bad solutions it rather fails in my opinion. Of course it could also be some independent warning and the constraint planning works as it should...
If it also generates bad solutions it rather fails in my opinion.
I agree!
I would expect it will fail as well (which would mean this is not an issue with MTC, but with your setup or MoveIt general).
You are right! This has nothing to do with MTC. When adding path constraints in the Connect
stage with a link_name from an attached object, MoveIt silence the ConstraintEvaluationResult to success. I will add a pull request by the end of the week. My initial fix fixes this issue, but I will do more testing.
On the other hand the ComputeIK
stage can retrieve the attached object because it uses the getWorld function to calculate the transformation.
``` terminal
(gdb) backtrace
#0 moveit::core::RobotModel::getLinkModel (this=0x555556f0b730, name="cuvette", has_link=0x0) at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/robot_model/src/robot_model.cpp:1162
#1 0x00007ffff3891c41 in moveit::core::RobotModel::getLinkModel (this=0x555556f0b730, name="cuvette", has_link=0x0)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/robot_model/src/robot_model.cpp:1137
#2 0x00007ffff2b3e686 in kinematic_constraints::OrientationConstraint::configure (this=0x55555d4f56d0, oc=..., tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:501
#3 0x00007ffff2b44f52 in kinematic_constraints::KinematicConstraintSet::add (this=0x7fffffff8880, oc=std::vector of length 1, capacity 1 = {...}, tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:1111
#4 0x00007ffff2b45241 in kinematic_constraints::KinematicConstraintSet::add (this=0x7fffffff8880, c=..., tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:1140
#5 0x00007ffff72d8da1 in planning_scene::PlanningScene::isPathValid (this=0x55555d005d30, trajectory=..., path_constraints=..., goal_constraints=std::vector of length 0, capacity 0, group="left_eef",
verbose=false, invalid_index=0x7fffffff8a50) at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/planning_scene/src/planning_scene.cpp:2170
#6 0x00007ffff72d941a in planning_scene::PlanningScene::isPathValid (this=0x55555d005d30, trajectory=..., path_constraints=..., group="left_eef", verbose=false, invalid_index=0x7fffffff8a50)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/planning_scene/src/planning_scene.cpp:2232
#7 0x00007fffe9e0465a in planning_pipeline::PlanningPipeline::generatePlan(std::shared_ptr
``` terminal (gdb) backtrace #0 moveit::core::RobotModel::getLinkModel (this=0x555556f0b6f0, name="cuvette", has_link=0x7fffffff8b7e) at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/robot_model/src/robot_model.cpp:1163 #1 0x00007ffff3891c41 in moveit::core::RobotModel::getLinkModel (this=0x555556f0b6f0, name="cuvette", has_link=0x7fffffff8b7e) at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/robot_model/src/robot_model.cpp:1137 #2 0x00007ffff1b424e3 in moveit::core::RobotState::getFrameInfo (this=0x555557e38cb0, frame_id="cuvette", robot_link=@0x7fffffff8b80: 0x5555570a2670, frame_found=@0x7fffffff8b7e: false) at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/robot_state/src/robot_state.cpp:1063 #3 0x00007ffff1b42118 in moveit::core::RobotState::getFrameTransform (this=0x555557e38cb0, frame_id="cuvette", frame_found=0x7fffffff8c4f) at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/robot_state/src/robot_state.cpp:1040 #4 0x00007ffff72d6ff9 in planning_scene::PlanningScene::getFrameTransform (this=0x555556d1c290, state=..., frame_id="cuvette") at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/planning_scene/src/planning_scene.cpp:1875 #5 0x00007ffff72d6f3e in planning_scene::PlanningScene::getFrameTransform (this=0x555556d1c290, frame_id="cuvette") at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/planning_scene/src/planning_scene.cpp:1864 #6 0x00007fffed84ca2c in moveit::task_constructor::stages::ComputeIK::compute_ (this=0x55555712f720) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/stages/compute_ik.cpp:276 #7 0x00007fffed84ebdf in moveit::task_constructor::stages::ComputeIK::compute (this=0x55555712f720) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/stages/compute_ik.cpp:454 #8 0x00007fffeddb9ac1 in moveit::task_constructor::ContainerBasePrivate::compute (this=0x5555571b8530) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/container.cpp:106 #9 0x00007fffeddc4215 in moveit::task_constructor::StagePrivate::runCompute (this=0x5555571b8530) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/include/moveit/task_constructor/stage_p.h:152 #10 0x00007fffeddbe6eb in moveit::task_constructor::Alternatives::compute (this=0x55555719ff80) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/container.cpp:712 #11 0x00007fffeddb9ac1 in moveit::task_constructor::ContainerBasePrivate::compute (this=0x555557135d20) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/container.cpp:106 #12 0x00007fffeddc4215 in moveit::task_constructor::StagePrivate::runCompute (this=0x555557135d20) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/include/moveit/task_constructor/stage_p.h:152 #13 0x00007fffeddbd113 in moveit::task_constructor::SerialContainer::compute (this=0x5555570a0490) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/container.cpp:531 #14 0x00007fffeddb9ac1 in moveit::task_constructor::ContainerBasePrivate::compute (this=0x5555571c11c0) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/container.cpp:106 #15 0x00007fffeddc4215 in moveit::task_constructor::StagePrivate::runCompute (this=0x5555571c11c0) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/include/moveit/task_constructor/stage_p.h:152 #16 0x00007fffeddbd113 in moveit::task_constructor::SerialContainer::compute (this=0x555556d2a280) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/container.cpp:531 #17 0x00007fffeddb9ac1 in moveit::task_constructor::ContainerBasePrivate::compute (this=0x5555559da4d0) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/container.cpp:106 #18 0x00007fffeddc4215 in moveit::task_constructor::StagePrivate::runCompute (this=0x5555559da4d0) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/include/moveit/task_constructor/stage_p.h:152 #19 0x00007fffede48052 in moveit::task_constructor::Task::compute (this=0x555557196bf0) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/task.cpp:285 #20 0x00007fffede48128 in moveit::task_constructor::Task::plan (this=0x555557196bf0, max_solutions=30) at /home/bob/ws/ros/catkin_ws/src/moveit_task_constructor/core/src/task.cpp:297 #21 0x00007fffee365a18 in MtcPlanner::plan (this=0x7fffffffaa00, task_name="action0", c=..., max_solutions=30) at /home/bob/ws/ros/catkin_ws/src/bob/bob_planner/src/mtc/mtc_planner.cpp:655 #22 0x00007ffff5a92f49 in ProtocolPlanner::plan (this=0x7fffffffb640, action_block=std::vector of length 5, capacity 5 = {...}, max_solutions=30) at /home/bob/ws/ros/catkin_ws/src/bob/bob_planner/src/protocol_planner/protocol_planner.cpp:280 #23 0x00005555556657be in test_dual_eef_protocol2 () at /home/bob/ws/ros/catkin_ws/src/bob/bob_planner/src/pp.cpp:560 #24 0x000055555567fb82 in main (argc=1, argv=0x7fffffffc168) at /home/bob/ws/ros/catkin_ws/src/bob/bob_planner/src/pp.cpp:1970 ```
I will add a pull request by the end of the week.
Thanks! Looking forward to review it.
On the other hand the ComputeIK stage can retrieve the attached object
yes, it's a very different code path.
I will add a pull request by the end of the week.
Basically what I wrote was something that resembles the ResolveConstraintFrames
function before I fond out that the ResolveConstraintFrames is not always triggered! So for the same Connect stage the planning has completly different backtraces
``` terminal
(gdb) backtrace
#0 moveit::core::RobotModel::getLinkModel (this=0x555556f0b730, name="cuvette", has_link=0x0) at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/robot_model/src/robot_model.cpp:1162
#1 0x00007ffff3891c41 in moveit::core::RobotModel::getLinkModel (this=0x555556f0b730, name="cuvette", has_link=0x0)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/robot_model/src/robot_model.cpp:1137
#2 0x00007ffff2b3e686 in kinematic_constraints::OrientationConstraint::configure (this=0x55555d4f56d0, oc=..., tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:501
#3 0x00007ffff2b44f52 in kinematic_constraints::KinematicConstraintSet::add (this=0x7fffffff8880, oc=std::vector of length 1, capacity 1 = {...}, tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:1111
#4 0x00007ffff2b45241 in kinematic_constraints::KinematicConstraintSet::add (this=0x7fffffff8880, c=..., tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:1140
#5 0x00007ffff72d8da1 in planning_scene::PlanningScene::isPathValid (this=0x55555d005d30, trajectory=..., path_constraints=..., goal_constraints=std::vector of length 0, capacity 0, group="left_eef",
verbose=false, invalid_index=0x7fffffff8a50) at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/planning_scene/src/planning_scene.cpp:2170
#6 0x00007ffff72d941a in planning_scene::PlanningScene::isPathValid (this=0x55555d005d30, trajectory=..., path_constraints=..., group="left_eef", verbose=false, invalid_index=0x7fffffff8a50)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/planning_scene/src/planning_scene.cpp:2232
#7 0x00007fffe9e0465a in planning_pipeline::PlanningPipeline::generatePlan(std::shared_ptr
``` terminal
(gdb) backtrace
#0 kinematic_constraints::OrientationConstraint::configure (this=0x55555d52edd0, state=..., oc=..., tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:539
#1 0x00007ffff2b50837 in kinematic_constraints::KinematicConstraintSet::add (this=0x55555d52ecc0, state=..., oc=std::vector of length 1, capacity 1 = {...}, tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:1176
#2 0x00007ffff2b50b37 in kinematic_constraints::KinematicConstraintSet::add (this=0x55555d52ecc0, state=..., c=..., tf=...)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/kinematic_constraints/src/kinematic_constraint.cpp:1206
#3 0x00007ffff72e432a in planning_scene::PlanningScene::isStateConstrained (this=0x55555d011f20, state=..., constr=..., verbose=false)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/planning_scene/src/planning_scene.cpp:2060
#4 0x00007ffff72e47b2 in planning_scene::PlanningScene::isStateValid (this=0x55555d011f20, state=..., constr=..., group="left_eef", verbose=false)
at /home/bob/ws/ros/catkin_ws/src/moveit/moveit_core/planning_scene/src/planning_scene.cpp:2108
#5 0x00007fffa663ffeb in default_planner_request_adapters::FixStartStatePathConstraints::adaptAndPlan(boost::function
I want to add a
constraint
in one of myConnect
stage. The constraint fails when the link_name is an attached object attached via theModifyPlanningScene
stage:From moveit tutorials it is possible to set the end-effector link to be an object an even a subframe.
When parsing the MTC library, I dont see the method
setEndEffectorLink
. Is this feature missing from MTC?