Skip to content
Snippets Groups Projects

Skill-Gui Stability and QOL

Merged Peter Albrecht requested to merge feature/skill-gui-stability into master
2 files
+ 53
1
Compare changes
  • Side-by-side
  • Inline
Files
2
#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) const
{
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) const
{
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,8 +425,11 @@ namespace armarx::skills::gui
.parameters = params};
ARMARX_CHECK(skillId.isFullySpecified()); // sanity check
ARMARX_IMPORTANT << "Executing skill from GUI: " << skillId << ".";
this->addParametersToHistory(skillId, params);
ARMARX_INFO << "Saved skill parameters to history...";
ARMARX_IMPORTANT << "Executing skill from GUI: " << skillId << ".";
try
{
std::scoped_lock l(mutex_memory);
Loading