diff --git a/source/RobotAPI/components/ViewSelection/ViewSelection.cpp b/source/RobotAPI/components/ViewSelection/ViewSelection.cpp index 4ee7ad2dd828d175a65471434c30e5d2ae8263ca..30a85a1937fe2b8c71203f1e60a284a984826403 100644 --- a/source/RobotAPI/components/ViewSelection/ViewSelection.cpp +++ b/source/RobotAPI/components/ViewSelection/ViewSelection.cpp @@ -40,6 +40,7 @@ void ViewSelection::onInitComponent() usingProxy(getProperty<std::string>("HeadIKUnitName").getValue()); offeringTopic("DebugDrawerUpdates"); + offeringTopic(getName() + "Observer"); headIKKinematicChainName = getProperty<std::string>("HeadIKKinematicChainName").getValue(); headFrameName = getProperty<std::string>("HeadFrameName").getValue(); @@ -105,6 +106,7 @@ void ViewSelection::onConnectComponent() headIKUnitProxy = getProxy<HeadIKUnitInterfacePrx>(getProperty<std::string>("HeadIKUnitName").getValue()); headIKUnitProxy->request(); + viewSelectionObserver = getTopic<ViewSelectionObserverPrx>(getName() + "Observer"); drawer = getTopic<DebugDrawerInterfacePrx>("DebugDrawerUpdates"); processorTask->start(); diff --git a/source/RobotAPI/components/ViewSelection/ViewSelection.h b/source/RobotAPI/components/ViewSelection/ViewSelection.h index 40d20090178faee01ba73d07d799aea35a71fa1c..496e202506739498bd1dd4600e24c83f11663419 100644 --- a/source/RobotAPI/components/ViewSelection/ViewSelection.h +++ b/source/RobotAPI/components/ViewSelection/ViewSelection.h @@ -154,15 +154,26 @@ namespace armarx boost::mutex::scoped_lock lock(manualViewTargetsMutex); ARMARX_INFO << "activating automatic view selection"; + doAutomaticViewSelection = true; + viewSelectionObserver->onActivateAutomaticViewSelection(); } virtual void deactivateAutomaticViewSelection(const Ice::Current& c = Ice::Current()) { boost::mutex::scoped_lock lock(manualViewTargetsMutex); - ARMARX_INFO << "DEactivating automatic view selection"; + ARMARX_INFO << "deactivating automatic view selection"; + doAutomaticViewSelection = false; + viewSelectionObserver->onDeactivateAutomaticViewSelection(); + } + + virtual bool isEnabledAutomaticViewSelection(const Ice::Current& c = Ice::Current()) + { + boost::mutex::scoped_lock lock(manualViewTargetsMutex); + + return doAutomaticViewSelection; } void updateSaliencyMap(const SaliencyMapBasePtr& map, const Ice::Current& c = ::Ice::Current()); @@ -179,6 +190,8 @@ namespace armarx HeadIKUnitInterfacePrx headIKUnitProxy; DebugDrawerInterfacePrx drawer; + ViewSelectionObserverPrx viewSelectionObserver; + std::string headIKKinematicChainName; std::string headFrameName; std::string cameraFrameName; diff --git a/source/RobotAPI/interface/components/ViewSelectionInterface.ice b/source/RobotAPI/interface/components/ViewSelectionInterface.ice index 4d1c04ed4c36f79467051a4c7c1bda272a0bc99e..cb9a180321730db25d8df560a1fbc428fa86ee82 100755 --- a/source/RobotAPI/interface/components/ViewSelectionInterface.ice +++ b/source/RobotAPI/interface/components/ViewSelectionInterface.ice @@ -35,7 +35,6 @@ module armarx const int DEFAULT_VIEWTARGET_PRIORITY = 50; - ["cpp:virtual"] class ViewTargetBase { @@ -76,11 +75,19 @@ module armarx void activateAutomaticViewSelection(); void deactivateAutomaticViewSelection(); + bool isEnabledAutomaticViewSelection(); void updateSaliencyMap(SaliencyMapBase map); }; + + interface ViewSelectionObserver + { + void onActivateAutomaticViewSelection(); + void onDeactivateAutomaticViewSelection(); + }; + }; #endif