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

[hybrid planning] improve planning scene monitoring #1090

Merged
merged 12 commits into from
Apr 4, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ bool ForwardTrajectory::initialize(const rclcpp::Node::SharedPtr& node,
{
stop_before_collision_ = node->declare_parameter<bool>("stop_before_collision", false);
}
planning_scene_monitor_ = planning_scene_monitor;
node_ = node;
path_invalidation_event_send_ = false;
num_iterations_stuck_ = 0;

planning_scene_monitor_ = planning_scene_monitor;
AndyZe marked this conversation as resolved.
Show resolved Hide resolved

return true;
}

Expand Down Expand Up @@ -106,6 +108,7 @@ ForwardTrajectory::solve(const robot_trajectory::RobotTrajectory& local_trajecto
bool is_path_valid = false;
// Lock the planning scene as briefly as possible
{
planning_scene_monitor_->updateSceneWithCurrentState();
planning_scene_monitor::LockedPlanningSceneRO locked_planning_scene(planning_scene_monitor_);
sjahr marked this conversation as resolved.
Show resolved Hide resolved
current_state = std::make_shared<moveit::core::RobotState>(locked_planning_scene->getCurrentState());
is_path_valid = locked_planning_scene->isPathValid(local_trajectory, local_trajectory.getGroupName(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ bool LocalPlannerComponent::initialize()
// Start state and scene monitors
planning_scene_monitor_->startSceneMonitor(config_.monitored_planning_scene_topic);
planning_scene_monitor_->startWorldGeometryMonitor(config_.collision_object_topic);
planning_scene_monitor_->startStateMonitor(config_.joint_states_topic);
planning_scene_monitor_->startStateMonitor(config_.joint_states_topic, "/attached_collision_object");
AndyZe marked this conversation as resolved.
Show resolved Hide resolved
planning_scene_monitor_->monitorDiffs(true);
planning_scene_monitor_->stopPublishingPlanningScene();

// Load trajectory operator plugin
try
Expand Down Expand Up @@ -264,8 +266,6 @@ void LocalPlannerComponent::executeIteration()
// If the planner received an action request and a global solution it starts to plan locally
case LocalPlannerState::LOCAL_PLANNING_ACTIVE:
{
planning_scene_monitor_->updateSceneWithCurrentState();

// Read current robot state
const moveit::core::RobotState current_robot_state = [this] {
planning_scene_monitor::LockedPlanningSceneRO ls(planning_scene_monitor_);
Expand Down