29#include <condition_variable>
33#include <Eigen/Geometry>
44#include <RobotAPI/interface/components/ViewSelectionInterface.h>
45#include <RobotAPI/interface/core/RobotState.h>
54 operator()(ViewTargetBasePtr
const& t1, ViewTargetBasePtr
const& t2)
56 if (t1->priority == t2->priority)
58 return t1->timeAdded->timestamp < t2->timeAdded->timestamp;
60 return t1->priority < t2->priority;
74 "RobotStateComponentName",
75 "RobotStateComponent",
76 "Name of the robot state component that should be used");
80 "Name of the head IK unit component that should be used");
83 "Name of the kinematic chain for the head IK");
87 "Name of the frame of the head base in the robot model");
91 "Name of the frame of the head base in the robot model");
94 "Time between two view changes, to keep the head looking "
95 "into one direction for a while (in ms)");
98 "Decide whether the automatic view selection will be "
99 "activated (can be changed via the proxy during runtime)");
101 "VisualizeViewDirection",
true,
"Draw view ray on DebugLayer.");
103 "MaxOverallHeadTiltAngle",
105 "Maximal angle the head and eyes can look down (in degrees)");
107 "CentralHeadTiltAngle",
109 "Defines the height direction that will be considered 'central' in the reachable "
110 "area of the head (in degrees). Default is looking 20 degrees downwards");
112 "ProbabilityToLookForALostObject",
114 "Probability that one of the objects that have been seen but could later not been "
115 "localized again will be included in the view selection");
117 "VisuSaliencyThreshold",
119 "If greater than zero the saliency map is drawn into the debug drawer on each "
120 "iteration. The value is used as minimum saliency threshold for a point to be "
121 "shown in debug visu");
147 return "ViewSelection";
177 const Ice::Current&
c = Ice::emptyCurrent)
override;
186 std::unique_lock lock(manualViewTargetsMutex);
188 ARMARX_INFO <<
"activating automatic view selection";
190 doAutomaticViewSelection =
true;
191 viewSelectionObserver->onActivateAutomaticViewSelection();
197 std::unique_lock lock(manualViewTargetsMutex);
199 ARMARX_INFO <<
"deactivating automatic view selection";
201 doAutomaticViewSelection =
false;
202 viewSelectionObserver->onDeactivateAutomaticViewSelection();
208 std::unique_lock lock(manualViewTargetsMutex);
210 return doAutomaticViewSelection;
214 const Ice::Current&
c = Ice::emptyCurrent)
override;
217 const Ice::Current&
c = Ice::emptyCurrent)
override;
222 const Ice::Current&
c = Ice::emptyCurrent)
override;
230 ViewTargetBasePtr nextAutomaticViewTarget();
232 void getActiveSaliencyMaps(std::vector<std::string>& activeSaliencyMaps);
237 HeadIKUnitInterfacePrx headIKUnitProxy;
240 ViewSelectionObserverPrx viewSelectionObserver;
242 std::string headIKKinematicChainName;
243 std::string headFrameName;
244 std::string cameraFrameName;
248 float sleepingTimeBetweenViewDirectionChanges;
249 IceUtil::Time timeOfLastViewChange;
251 bool drawViewDirection;
253 std::mutex manualViewTargetsMutex;
254 std::priority_queue<ViewTargetBasePtr, std::vector<ViewTargetBasePtr>,
CompareViewTargets>
257 bool doAutomaticViewSelection;
259 Eigen::Vector3f offsetToHeadCenter;
261 std::condition_variable condition;
262 bool hasNewSaliencyMap;
263 std::mutex syncMutex;
265 std::map<std::string, SaliencyMapBasePtr> saliencyMaps;
267 float visuSaliencyThreshold;
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Component()
Protected default constructor. Used for virtual inheritance. Use createManagedIceObject() instead.
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
ViewSelectionPropertyDefinitions(std::string prefix)
void addManualViewTarget(const FramedPositionBasePtr &target, const Ice::Current &c=Ice::emptyCurrent) override
void onInitComponent() override
void clearSaliencySphere(const Ice::Current &c=Ice::emptyCurrent) override
void removeSaliencyMap(const std::string &name, const Ice::Current &c=Ice::emptyCurrent) override
void onDisconnectComponent() override
ViewTargetList getManualViewTargets(const Ice::Current &c=Ice::emptyCurrent) override
void deactivateAutomaticViewSelection(const Ice::Current &c=Ice::emptyCurrent) override
void drawSaliencySphere(const ::Ice::StringSeq &names, const Ice::Current &c=Ice::emptyCurrent) override
::Ice::StringSeq getSaliencyMapNames(const Ice::Current &c=Ice::emptyCurrent) override
void updateSaliencyMap(const SaliencyMapBasePtr &map, const Ice::Current &c=Ice::emptyCurrent) override
void onConnectComponent() override
PropertyDefinitionsPtr createPropertyDefinitions() override
void activateAutomaticViewSelection(const Ice::Current &c=Ice::emptyCurrent) override
void clearManualViewTargets(const Ice::Current &c=Ice::emptyCurrent) override
void onExitComponent() override
std::string getDefaultName() const override
bool isEnabledAutomaticViewSelection(const Ice::Current &c=Ice::emptyCurrent) override
#define ARMARX_INFO
The normal logging level.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx
bool operator()(ViewTargetBasePtr const &t1, ViewTargetBasePtr const &t2)