Skip to content

Commit ab34f4d

Browse files
author
Mulo01
committed
Do not replan during planning phase in gui
1 parent dd2c0d3 commit ab34f4d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/gui/PlannerGui.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ PlannerGui::PlannerGui(const std::string& dumpName): QObject()
4646
goalViz.updateData(dump.getGoal());
4747

4848
planner->updateMap(dump.getMlsMap());
49-
50-
startPlanThread();
49+
50+
planning = false;
5151
}
5252

5353

@@ -579,6 +579,11 @@ void PlannerGui::replanButtonReleased()
579579

580580
void PlannerGui::startPlanThread()
581581
{
582+
583+
if (planning){
584+
return;
585+
}
586+
582587
bar->setMaximum(0);
583588
std::thread t([this](){
584589
#ifdef ENABLE_DEBUG_DRAWINGS
@@ -598,8 +603,6 @@ void PlannerGui::plannerIsDone()
598603
trajViz2.updateData(beautifiedPath);
599604
trajViz2.setLineWidth(8);
600605

601-
602-
603606
trav3dViz.updateData((planner->getTraversabilityMap().copyCast<maps::grid::TraversabilityNodeBase *>()));
604607
obstacleMapViz.updateData((planner->getObstacleMap().copyCast<maps::grid::TraversabilityNodeBase *>()));
605608

@@ -638,9 +641,11 @@ void PlannerGui::plan(const base::Pose& start, const base::Pose& goal)
638641
endState.orientation = goal.orientation;
639642

640643
LOG_INFO_S << "Planning: " << start << " -> " << goal;
644+
planning = true;
641645
const Planner::PLANNING_RESULT result = planner->plan(base::Time::fromSeconds(time->value()),
642646
startState, endState, path, beautifiedPath);
643647

648+
planning = false;
644649
switch(result)
645650
{
646651
case Planner::GOAL_INVALID:

src/gui/PlannerGui.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ private slots:
7474
void startPlanThread();
7575

7676
private:
77+
78+
bool planning;
7779
vizkit3d::Vizkit3DWidget* widget;
7880
QDoubleSpinBox* maxSlopeSpinBox;
7981
QDoubleSpinBox* slopeMetricScaleSpinBox;

0 commit comments

Comments
 (0)