35 #include <RobotAPI/interface/core/RobotState.h>
41 #include <RobotAPI/interface/units/TCPControlUnit.h>
48 class ObjectLocalizationMemoryUpdater;
56 defineOptionalProperty<std::string>(
"RobotStateComponentName",
"RobotStateComponent",
"Name of the RobotStateComponent");
57 defineOptionalProperty<std::string>(
"WorkingMemoryName",
"WorkingMemory",
"Name of the WorkingMemory component that should be used");
58 defineOptionalProperty<std::string>(
"LongtermMemoryName",
"LongtermMemory",
"Name of the LongtermMemory component that should be used");
59 defineOptionalProperty<std::string>(
"RobotStateObserverName",
"RobotStateObserver",
"Name of the RobotStateObserver that can be used for observing the head motion");
60 defineOptionalProperty<std::string>(
"GazeTCPName",
"VirtualCentralGaze",
"Name of the gaze tcp that can be used for observing the head motion");
61 defineOptionalProperty<std::string>(
"CommonPlacesLearnerName",
"",
"Name of the CommonPlacesLearner that will be trained when object instances are updated");
62 defineOptionalProperty<bool>(
"CheckFieldOfView",
false,
"Check if detected object is inside field of view.");
63 defineOptionalProperty<float>(
"ExistenceCertaintyReductionFactorWhenLocalizationFailed", 0.95f,
"Existence certainty will be reduced by this factor when a localization returns without result");
64 defineOptionalProperty<float>(
"CameraOpeningAngle", 30.0f *
M_PI / 180.0f,
"Very conservative estimation of the camera opening angle, in radians");
65 defineOptionalProperty<float>(
"MaximalObjectDistance", 1500.0f,
"Maximal distance an object may have from the camera to be localized");
66 defineOptionalProperty<std::string>(
"RobotNodeNameLeftCamera",
"EyeLeftCamera",
"Name of the robot node of the left camera");
67 defineOptionalProperty<std::string>(
"RobotNodeNameRightCamera",
"EyeRightCamera",
"Name of the robot node of the right camera");
68 defineOptionalProperty<float>(
"HeadMotionVelocityLimit", 100,
"Maximal velocity of the head up to which localizations are executed. Speed is in mm/s at a the virtual gaze tcp");
69 defineOptionalProperty<std::string>(
"HandNodeNameLeft",
"TCP L",
"Name of the robot node for the left hand/TCP");
70 defineOptionalProperty<std::string>(
"HandNodeNameRight",
"TCP R",
"Name of the robot node for the right hand/TCP");
72 defineOptionalProperty<std::string>(
"KBMReferenceNodeName",
"Cameras",
"Name of the robot node on which the KBM resides. Data should be provided wrt. to its coordinate frame (i.e., not be transformed by the robot model which introduces a new source of error).");
73 defineOptionalProperty<std::string>(
"KBMLeftArmNodeSetName",
"LeftArm",
"Name of the robot node set for the kinematic chain for the left arm.");
74 defineOptionalProperty<std::string>(
"KBMRightArmNodeSetName",
"RightArm",
"Name of the robot node set for the kinematic chain for the right arm.");
92 virtual public ObjectLocalizationMemoryUpdaterBase
96 void setSegmentNames(std::string classSegmentName, std::string instanceSegmentName);
97 void setReferenceFrame(
const std::string& referenceFrameName);
106 return "ObjectLocalizationMemoryUpdater";
112 void onInitComponent()
override;
113 void onConnectComponent()
override;
114 void onDisconnectComponent()
override;
117 void reportEntityCreated(
const std::string& segmentName,
const EntityBasePtr& entity,
const Ice::Current&
c = Ice::emptyCurrent)
override {}
118 void reportEntityUpdated(
const std::string& segmentName,
const EntityBasePtr& entityOld,
const EntityBasePtr& entityNew,
const Ice::Current&
c = Ice::emptyCurrent)
override;
119 void reportEntityRemoved(
const std::string& segmentName,
const EntityBasePtr& entity,
const Ice::Current&
c = Ice::emptyCurrent)
override {}
122 void reportMemoryCleared(
const std::string& segmentName,
const Ice::Current&
c = Ice::emptyCurrent)
override { }
132 void localizationFinished(
const Ice::AsyncResultPtr& r);
140 bool isRecognitionMethodRunning(
const std::string& recognitionMethod);
141 void setRecognitionMethodRunningState(
const std::string& recognitionMethod,
bool running);
144 ObjectLocalizerInterfacePrx getProxyCached(
const std::string& recognitionMethod);
145 LocalizationQueryList getMissingQueries(
const LocalizationQueryList& queriesBase,
const LocalizationQueryList& queriesCompare);
152 std::string workingMemoryName;
153 std::string classSegmentName;
154 std::string instanceSegmentName;
155 std::string agentInstancesSegmentName;
157 ObjectClassMemorySegmentBasePtr objectClassSegment;
159 std::string referenceFrameName;
160 std::string agentName;
164 std::mutex jobsMutex;
165 std::mutex predictionMutex;
166 std::vector<LocalizationJobPtr> jobs;
169 std::mutex recognitionMethodStateMutex;
170 std::map<std::string, bool> recognitionMethodRunning;
173 std::map<std::string, ObjectLocalizerInterfacePrx> knownObjectProxies;
177 armarx::ObserverInterfacePrx robotStateObserverProxy;
179 float headMotionVelocityLimit;
182 memoryx::CommonPlacesLearnerInterfacePrx commonPlacesLearnerProxy;
185 bool checkFieldOfView;
186 float cameraOpeningAngle;
187 std::string robotNodeNameLeftCamera, robotNodeNameRightCamera, handNodeNameLeft, handNodeNameRight;
189 LongtermMemoryInterfacePrx longtermMemoryPrx;
200 str <<
"Set(" <<
set.size() <<
"):\n";
202 for (
const auto& elem :
set)
204 str <<
"\t" << elem <<
"\n";