Skip to content
Snippets Groups Projects
Commit db1c599c authored by Fabian Reister's avatar Fabian Reister
Browse files

Merge branch 'feature/reload-grasps-on-file-change' into 'master'

GraspMemory: Reload grasps on file change

See merge request !513
parents 05f9d496 6b3619b9
No related branches found
No related tags found
1 merge request!513GraspMemory: Reload grasps on file change
Pipeline #22264 failed
......@@ -51,7 +51,7 @@ namespace armarx::plugins
bool
RobotStateComponentPlugin::hasRobot(const std::string& id) const
{
std::lock_guard{_robotsMutex};
std::lock_guard g{_robotsMutex};
return _robots.count(id);
}
......@@ -70,7 +70,7 @@ namespace armarx::plugins
{
ARMARX_CHECK_EXPRESSION(robot == node->getRobot());
}
std::lock_guard{_robotsMutex};
std::lock_guard g {_robotsMutex};
ARMARX_CHECK_EXPRESSION(!hasRobot(id)) << "Robot with id '" << id << "' was already added";
if (rns && !node)
{
......@@ -147,7 +147,7 @@ namespace armarx::plugins
RobotStateComponentPlugin::RobotData
RobotStateComponentPlugin::getRobotData(const std::string& id) const
{
std::lock_guard{_robotsMutex};
std::lock_guard g{_robotsMutex};
ARMARX_CHECK_EXPRESSION(hasRobot(id)) << "No robot with id '" << id << "' loaded";
return _robots.at(id);
}
......@@ -157,7 +157,7 @@ namespace armarx::plugins
const std::string& rnsName,
const std::string& nodeName)
{
std::lock_guard{_robotsMutex};
std::lock_guard g{_robotsMutex};
ARMARX_CHECK_EXPRESSION(hasRobot(id)) << "No robot with id '" << id << "' loaded";
auto& r = _robots.at(id);
ARMARX_CHECK_EXPRESSION(!rnsName.empty())
......
#pragma once
#include <RobotAPI/libraries/ArmarXObjects/ObjectFinder.h>
#include <RobotAPI/libraries/armem/server/segment/SpecializedSegment.h>
#include <filesystem>
#include <optional>
#include <ArmarXCore/core/services/tasks/TaskUtil.h>
#include "RobotAPI/libraries/ArmarXObjects/ObjectID.h"
#include "RobotAPI/libraries/ArmarXObjects/ObjectInfo.h"
#include "RobotAPI/libraries/armem/server/forward_declarations.h"
#include "RobotAPI/libraries/armem/server/segment/SpecializedProviderSegment.h"
#include <RobotAPI/libraries/armem_grasping/aron/KnownGraspCandidate.aron.generated.h>
namespace armarx::armem::grasping::segment
......@@ -19,6 +26,27 @@ namespace armarx::armem::grasping::segment
void loadMemory();
std::optional<arondto::KnownGraspInfo> knownGraspInfoFromObjectInfo(const ObjectInfo&);
struct GraspFileInfo
{
PackageFileLocation fileLocInfo;
ObjectID objectId;
static GraspFileInfo FromObjectInfo(const ObjectInfo& objectInfo)
{
const std::string objectClassName = objectInfo.className();
PackageFileLocation fileLocInfo = objectInfo.file(".xml", "_Grasps");
return GraspFileInfo{.fileLocInfo = fileLocInfo, .objectId = objectInfo.id()};
}
};
std::optional<arondto::KnownGraspInfo>
knownGraspInfoFromFile(const GraspFileInfo& graspFileInfo);
void installFileWatcher();
SimpleRunningTask<>::pointer_type fileWatcherTask;
public:
static const constexpr char* CORE_SEGMENT_NAME = "KnownGraspCandidate";
static const constexpr char* PROVIDER_SEGMENT_NAME = "PriorKnowledgeData";
......
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