31 #include <RobotAPI/interface/core/RobotState.h>
32 #include <RobotAPI/interface/units/TCPControlUnit.h>
45 class ObjectLocalizationMemoryUpdater;
53 defineOptionalProperty<std::string>(
"RobotStateComponentName",
54 "RobotStateComponent",
55 "Name of the RobotStateComponent");
56 defineOptionalProperty<std::string>(
59 "Name of the WorkingMemory component that should be used");
60 defineOptionalProperty<std::string>(
63 "Name of the LongtermMemory component that should be used");
64 defineOptionalProperty<std::string>(
65 "RobotStateObserverName",
67 "Name of the RobotStateObserver that can be used for observing the head motion");
68 defineOptionalProperty<std::string>(
71 "Name of the gaze tcp that can be used for observing the head motion");
72 defineOptionalProperty<std::string>(
"CommonPlacesLearnerName",
74 "Name of the CommonPlacesLearner that will be "
75 "trained when object instances are updated");
76 defineOptionalProperty<bool>(
77 "CheckFieldOfView",
false,
"Check if detected object is inside field of view.");
78 defineOptionalProperty<float>(
"ExistenceCertaintyReductionFactorWhenLocalizationFailed",
80 "Existence certainty will be reduced by this factor when "
81 "a localization returns without result");
82 defineOptionalProperty<float>(
84 30.0f *
M_PI / 180.0f,
85 "Very conservative estimation of the camera opening angle, in radians");
86 defineOptionalProperty<float>(
87 "MaximalObjectDistance",
89 "Maximal distance an object may have from the camera to be localized");
90 defineOptionalProperty<std::string>(
"RobotNodeNameLeftCamera",
92 "Name of the robot node of the left camera");
93 defineOptionalProperty<std::string>(
"RobotNodeNameRightCamera",
95 "Name of the robot node of the right camera");
96 defineOptionalProperty<float>(
97 "HeadMotionVelocityLimit",
99 "Maximal velocity of the head up to which localizations are executed. Speed is in "
100 "mm/s at a the virtual gaze tcp");
101 defineOptionalProperty<std::string>(
102 "HandNodeNameLeft",
"TCP L",
"Name of the robot node for the left hand/TCP");
103 defineOptionalProperty<std::string>(
104 "HandNodeNameRight",
"TCP R",
"Name of the robot node for the right hand/TCP");
106 defineOptionalProperty<std::string>(
107 "KBMReferenceNodeName",
109 "Name of the robot node on which the KBM resides. Data should be provided wrt. to "
110 "its coordinate frame (i.e., not be transformed by the robot model which "
111 "introduces a new source of error).");
112 defineOptionalProperty<std::string>(
113 "KBMLeftArmNodeSetName",
115 "Name of the robot node set for the kinematic chain for the left arm.");
116 defineOptionalProperty<std::string>(
117 "KBMRightArmNodeSetName",
119 "Name of the robot node set for the kinematic chain for the right arm.");
136 virtual public ObjectLocalizationMemoryUpdaterBase
140 void setSegmentNames(std::string classSegmentName, std::string instanceSegmentName);
141 void setReferenceFrame(
const std::string& referenceFrameName);
153 return "ObjectLocalizationMemoryUpdater";
159 void onInitComponent()
override;
160 void onConnectComponent()
override;
161 void onDisconnectComponent()
override;
166 const EntityBasePtr& entity,
167 const Ice::Current&
c = Ice::emptyCurrent)
override
171 void reportEntityUpdated(
const std::string& segmentName,
172 const EntityBasePtr& entityOld,
173 const EntityBasePtr& entityNew,
174 const Ice::Current&
c = Ice::emptyCurrent)
override;
178 const EntityBasePtr& entity,
179 const Ice::Current&
c = Ice::emptyCurrent)
override
185 const Ice::Current&
c = Ice::emptyCurrent)
override
196 const Ice::Current&
c = Ice::emptyCurrent)
override
208 void localizationFinished(
const Ice::AsyncResultPtr& r);
216 bool isRecognitionMethodRunning(
const std::string& recognitionMethod);
217 void setRecognitionMethodRunningState(
const std::string& recognitionMethod,
bool running);
220 ObjectLocalizerInterfacePrx getProxyCached(
const std::string& recognitionMethod);
221 LocalizationQueryList getMissingQueries(
const LocalizationQueryList& queriesBase,
222 const LocalizationQueryList& queriesCompare);
229 std::string workingMemoryName;
230 std::string classSegmentName;
231 std::string instanceSegmentName;
232 std::string agentInstancesSegmentName;
234 ObjectClassMemorySegmentBasePtr objectClassSegment;
236 std::string referenceFrameName;
237 std::string agentName;
241 std::mutex jobsMutex;
242 std::mutex predictionMutex;
243 std::vector<LocalizationJobPtr> jobs;
246 std::mutex recognitionMethodStateMutex;
247 std::map<std::string, bool> recognitionMethodRunning;
250 std::map<std::string, ObjectLocalizerInterfacePrx> knownObjectProxies;
254 armarx::ObserverInterfacePrx robotStateObserverProxy;
256 float headMotionVelocityLimit;
259 memoryx::CommonPlacesLearnerInterfacePrx commonPlacesLearnerProxy;
262 bool checkFieldOfView;
263 float cameraOpeningAngle;
264 std::string robotNodeNameLeftCamera, robotNodeNameRightCamera, handNodeNameLeft,
267 LongtermMemoryInterfacePrx longtermMemoryPrx;
273 template <
typename T>
277 str <<
"Set(" <<
set.size() <<
"):\n";
279 for (
const auto& elem :
set)
281 str <<
"\t" << elem <<
"\n";