Skip to content
Snippets Groups Projects
Commit c5c9a18a authored by Peter Albrecht's avatar Peter Albrecht
Browse files

Implemented re-running with similar params

parent dc67ff59
No related branches found
No related tags found
1 merge request!406Refactor skill memory GUI
......@@ -27,13 +27,13 @@ namespace armarx::skills::gui
menu->addAction(stopSkillAction);
menu->addAction(rerunSkillAction);
connect(stopSkillAction,
SIGNAL(stopSkillAction.triggered()),
&QAction::triggered,
this,
SIGNAL(stopSelectedExecution()));
&SkillExecutionTreeWidget::stopSelectedExecution);
connect(rerunSkillAction,
SIGNAL(rerunSkillAction.triggered()),
&QAction::triggered,
this,
SIGNAL(rerunSkillWithSimilarParams()));
&SkillExecutionTreeWidget::rerunSkillWithSimilarParams);
// Temporarily disable rerun-skill-Action
rerunSkillAction->setDisabled(true);
......@@ -48,6 +48,25 @@ namespace armarx::skills::gui
memory->stopExecution(this->selectedExecution.skillExecutionId);
}
void
SkillExecutionTreeWidget::rerunSkillWithSimilarParams()
{
// we don't want to hold state in the gui, so we need to get the parameters from memory:
skills::SkillExecutionID currentExecutionId = this->selectedExecution.skillExecutionId;
auto update = memory->getLatestUpdate();
if (!update.statuses.contains(currentExecutionId))
{
// we didn't find an entry for the execution id
ARMARX_IMPORTANT << "The selected execution was not found in memory. The GUI is unable "
"to determine the parametrization for this execution.";
return;
}
auto params = update.statuses[currentExecutionId].parameters;
// give all information to manager
this->memory->startExecutionWithParams(currentExecutionId.skillId, params);
}
void
SkillExecutionTreeWidget::refresh()
{
......@@ -61,7 +80,12 @@ namespace armarx::skills::gui
SkillExecutionTreeWidgetItem* found = nullptr;
for (int i = 0; i < this->topLevelItemCount(); ++i)
{
auto c = static_cast<SkillExecutionTreeWidgetItem*>(topLevelItem(i));
auto c = dynamic_cast<SkillExecutionTreeWidgetItem*>(topLevelItem(i));
if (!c)
{
// the item is probably not the correct type, skip...
continue;
}
found = SkillExecutionTreeWidgetItem::SearchRecursiveForMatch(c, executionId);
......
......@@ -47,14 +47,13 @@ namespace armarx::skills::gui
SelectedExecution& getSelectedExecution();
signals:
void rerunSkillWithSimilarParams();
private slots:
void stopAllExecutions();
void executionSelectionChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
void refresh();
void runContextMenu(const QPoint& pos);
void stopSelectedExecution();
void rerunSkillWithSimilarParams();
private:
void setupUi();
......
......@@ -27,12 +27,10 @@ namespace armarx::skills::gui
SearchRecursiveForMatch(SkillExecutionTreeWidgetItem* haystack,
const skills::SkillExecutionID& needle);
skills::SkillExecutionID getExecutionID();
void updateItem(skills::SkillStatus status);
protected:
skills::SkillExecutionID executionId;
private:
void setupUi();
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment