Skip to content

Commit

Permalink
Merge pull request moveit#452 from Jntzko/fixMotionPlanningDisplay
Browse files Browse the repository at this point in the history
correct "simplify widget handling"
  • Loading branch information
130s authored Mar 7, 2017
2 parents 6f8871c + f16c1ea commit ed43752
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include <rviz/display.h>
#include <rviz/selection/selection_manager.h>
#include <rviz/panel_dock_widget.h>
#include <moveit/planning_scene_rviz_plugin/planning_scene_display.h>
#include <moveit/rviz_plugin_render_tools/trajectory_visualization.h>
#include <std_msgs/String.h>
Expand Down Expand Up @@ -165,6 +166,7 @@ private Q_SLOTS:
void changedMetricsTextHeight();
void changedWorkspace();
void resetInteractiveMarkers();
void motionPanelVisibilityChange(bool enable);

protected:
enum LinkDisplayStatus
Expand Down Expand Up @@ -233,6 +235,7 @@ private Q_SLOTS:

// the planning frame
MotionPlanningFrame* frame_;
rviz::PanelDockWidget* frame_dock_;

// robot interaction
robot_interaction::RobotInteractionPtr robot_interaction_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ MotionPlanningDisplay::MotionPlanningDisplay()
, text_to_display_(NULL)
, private_handle_("~")
, frame_(NULL)
, frame_dock_(NULL)
, menu_handler_start_(new interactive_markers::MenuHandler)
, menu_handler_goal_(new interactive_markers::MenuHandler)
, int_marker_display_(NULL)
Expand Down Expand Up @@ -185,6 +186,7 @@ MotionPlanningDisplay::~MotionPlanningDisplay()

delete text_to_display_;
delete int_marker_display_;
delete frame_dock_;
}

void MotionPlanningDisplay::onInitialize()
Expand Down Expand Up @@ -224,7 +226,12 @@ void MotionPlanningDisplay::onInitialize()
// immediately switch to next trajectory display after planning
connect(frame_, SIGNAL(planningFinished()), trajectory_visual_.get(), SLOT(interruptCurrentDisplay()));

setAssociatedWidget(frame_);
if (window_context)
{
frame_dock_ = window_context->addPane("Motion Planning", frame_);
connect(frame_dock_, SIGNAL(visibilityChanged(bool)), this, SLOT(motionPanelVisibilityChange(bool)));
frame_dock_->setIcon(getIcon());
}

int_marker_display_ = context_->getDisplayFactory()->make("rviz/InteractiveMarkers");
int_marker_display_->initialize(context_);
Expand All @@ -246,6 +253,12 @@ void MotionPlanningDisplay::onInitialize()
}
}

void MotionPlanningDisplay::motionPanelVisibilityChange(bool enable)
{
if (enable)
setEnabled(true);
}

void MotionPlanningDisplay::toggleSelectPlanningGroupSubscription(bool enable)
{
if (enable)
Expand Down Expand Up @@ -1211,6 +1224,7 @@ void MotionPlanningDisplay::onEnable()

query_robot_start_->setVisible(query_start_state_property_->getBool());
query_robot_goal_->setVisible(query_goal_state_property_->getBool());
frame_->enable();

int_marker_display_->setEnabled(true);
int_marker_display_->setFixedFrame(fixed_frame_);
Expand All @@ -1227,6 +1241,7 @@ void MotionPlanningDisplay::onDisable()

query_robot_start_->setVisible(false);
query_robot_goal_->setVisible(false);
frame_->disable();
text_to_display_->setVisible(false);

PlanningSceneDisplay::onDisable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,14 @@ void MotionPlanningFrame::enable()
ui_->object_status->setText("");

// activate the frame
parentWidget()->show();
show();
}

void MotionPlanningFrame::disable()
{
move_group_.reset();
parentWidget()->hide();
hide();
}

Expand Down

0 comments on commit ed43752

Please sign in to comment.