Skip to content
Snippets Groups Projects

Urgent Skill Manipulation Features in SkillMemoryGUI

Merged Peter Albrecht requested to merge feature/skillMemoryGUI into master
@@ -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->abortSkill(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
Loading