Skip to content
Snippets Groups Projects

Skill-Gui Stability and QOL

Merged Peter Albrecht requested to merge feature/skill-gui-stability into master
Files
8
#include "SkillManagerWrapper.h"
#include <mutex>
#include <optional>
#include <SimoxUtility/algorithm/string/string_tools.h>
@@ -241,6 +242,39 @@ namespace armarx::skills::gui
// notify registered widgets of update
emit updateAvailable(filterUpdate(snapshot));
}
std::vector<Parameters> SkillManagerWrapper::getParameterHistoryForSkill(const skills::SkillID& sid)
{
if (not this->skillParameterHistory.contains(sid))
{
return {};
}
return this->skillParameterHistory[sid];
}
void SkillManagerWrapper::addParametersToHistory(const skills::SkillID& sid, const Parameters& params)
{
if (not this->skillParameterHistory.contains(sid))
{
// no history exists for this skill. Assign new
this->skillParameterHistory.insert({sid, {params}});
}
else
{
// history already exists. Append to list
this->skillParameterHistory[sid].emplace_back(params);
}
}
std::optional<Parameters> SkillManagerWrapper::getLatestParametersForSkill(const skills::SkillID& sid)
{
auto parameterList = getParameterHistoryForSkill(sid);
if (parameterList.empty())
{
return std::nullopt;
}
return parameterList.back();
}
const std::optional<ProviderID>
SkillManagerWrapper::findFirstProvider(SkillMap const& map, SkillID const& skillId)
@@ -391,6 +425,10 @@ namespace armarx::skills::gui
.parameters = params};
ARMARX_CHECK(skillId.isFullySpecified()); // sanity check
this->addParametersToHistory(skillId, params);
ARMARX_INFO << "Saved skill parameters to history...";
ARMARX_IMPORTANT << "Executing skill from GUI: " << skillId << ".";
try
Loading