Skip to content

Commit 2450127

Browse files
committed
Clear JointStates in scene diff before execution
Joints are handled in trajectories. Scene diffs should not modify joints during execution. Fixes moveit#353. Alternative to moveit#504. The previous solution, to always clear the joint states during message generation, broke the visualization in rviz.
1 parent 5a8925d commit 2450127

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

capabilities/src/execute_task_solution_capability.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,15 @@ bool ExecuteTaskSolutionCapability::constructMotionPlan(const moveit_task_constr
170170
exec_traj.controller_names_ = sub_traj.execution_info.controller_names;
171171

172172
/* TODO add action feedback and markers */
173-
exec_traj.effect_on_success_ = [this, sub_traj,
173+
exec_traj.effect_on_success_ = [this,
174+
&scene_diff = const_cast<::moveit_msgs::PlanningScene&>(sub_traj.scene_diff),
174175
description](const plan_execution::ExecutableMotionPlan* /*plan*/) {
175-
if (!moveit::core::isEmpty(sub_traj.scene_diff)) {
176+
scene_diff.robot_state.joint_state = sensor_msgs::JointState();
177+
scene_diff.robot_state.multi_dof_joint_state = sensor_msgs::MultiDOFJointState();
178+
179+
if (!moveit::core::isEmpty(scene_diff)) {
176180
ROS_DEBUG_STREAM_NAMED("ExecuteTaskSolution", "apply effect of " << description);
177-
return context_->planning_scene_monitor_->newPlanningSceneMessage(sub_traj.scene_diff);
181+
return context_->planning_scene_monitor_->newPlanningSceneMessage(scene_diff);
178182
}
179183
return true;
180184
};

0 commit comments

Comments
 (0)