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

Merge branch 'feature/skillMemoryGUI' of...

Merge branch 'feature/skillMemoryGUI' of git.h2t.iar.kit.edu:sw/armarx/robot-api into feature/skillMemoryGUI
parents 1f912d4f 17972d59
No related branches found
No related tags found
1 merge request!406Refactor skill memory GUI
Pipeline #16201 failed
......@@ -570,14 +570,67 @@ namespace armarx
void
SkillManagerMonitorWidgetController::stopAllExecutions()
{
auto tree = widget.treeWidgetSkillExecutions;
ARMARX_INFO << "The user requested to stop all skill executions from GUI.";
for (ssize_t i = 0; i < tree->topLevelItemCount(); ++i)
QTreeWidget const* tree = widget.treeWidgetSkillExecutions;
int const max_retries = 3;
int left_retries = max_retries;
bool retry = false;
do
{
auto item = static_cast<SkillExecutionInfoTreeWidgetItem*>(
widget.treeWidgetSkillExecutions->topLevelItem(i));
memory->abortSkillAsync(item->executionId.toManagerIce());
}
retry = false;
for (ssize_t i = 0; i < tree->topLevelItemCount(); ++i)
{
SkillExecutionInfoTreeWidgetItem const* item =
dynamic_cast<SkillExecutionInfoTreeWidgetItem*>(
widget.treeWidgetSkillExecutions->topLevelItem(i));
if (not item)
{
// At this point, dynamic-casting failed and we don't know anything about the
// type.
ARMARX_ERROR << "Cannot stop unknown skill.";
retry = true;
continue;
}
try
{
ARMARX_INFO << "Aborting skill '" << item->executionId.skillId.skillName
<< "'...";
memory->abortSkillAsync(item->executionId.toManagerIce());
}
catch (Ice::Exception const& e)
{
retry = true;
ARMARX_ERROR << "Unhandeled Ice exception while aborting skill '"
<< item->executionId.skillId.skillName << "'.";
}
catch (...)
{
retry = true;
ARMARX_ERROR << "Unhandled error while aborting skill '"
<< item->executionId.skillId.skillName << "'.";
}
}
if (retry)
{
left_retries -= 1;
if (left_retries > 0)
{
ARMARX_WARNING << "There where errors aborting skills. Retrying...";
}
else
{
ARMARX_ERROR << "Couldn't abort all skills after " << max_retries
<< " tries. Giving up.";
retry = false;
}
}
} while (retry);
}
void
......
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