Skip to content
Snippets Groups Projects

Urgent Skill Manipulation Features in SkillMemoryGUI

Merged Peter Albrecht requested to merge feature/skillMemoryGUI into master
All threads resolved!
@@ -570,13 +570,67 @@ namespace armarx
void
SkillManagerMonitorWidgetController::stopAllExecutions()
{
auto tree = widget.treeWidgetSkillExecutions;
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
@@ -585,8 +639,6 @@ namespace armarx
std::scoped_lock l(updateMutex);
/*
* Example skills are not fully specified; disabled check
*
if (selectedSkill.skillExecutionId.skillId.fullySpecified())
{
ARMARX_INFO << "The user requested to stop a skill, which was not fully specified!";
@@ -598,7 +650,7 @@ namespace armarx
{
return;
}
*/
*/
ARMARX_INFO << "Stopping skill from GUI: " << selectedSkill.skillExecutionId.toString();
@@ -639,14 +691,14 @@ namespace armarx
if (!current->parent())
{
// no parent available. Perhaps provider clicked? Reset selected skill.
selectedSkill.skillId.providerId->providerName = "";
selectedSkill.skillId.skillName = "";
selectedSkill.skillId = SelectedSkill::UNK_SKILL_ID;
return;
}
auto c = static_cast<SkillInfoTreeWidgetItem*>(current);
auto skillDescription = c->skillDescription;
if (selectedSkill.skillId == skillDescription.skillId)
{
// no change
Loading