Go to the documentation of this file.
42 _driver = std::make_unique<BLEProthesisInterface>(getProperty<std::string>(
"MAC"));
56 if (!getProperty<std::string>(
"RemoteGuiName").getValue().
empty())
58 usingProxy(getProperty<std::string>(
"RemoteGuiName"));
64 _debugObserver = getTopic<DebugObserverInterfacePrx>(getProperty<std::string>(
"DebugObserverName"));
65 if (!getProperty<std::string>(
"RemoteGuiName").getValue().
empty())
67 _remoteGuiPrx = getProxy<RemoteGuiInterfacePrx>(getProperty<std::string>(
"RemoteGuiName").getValue());
72 auto addFinger = [&](std::string name,
float min,
float max,
float val,
int steps)
95 addFinger(
"Thumb", 0, 1, _lastGuiValueThumb, _driver->getMaxPosThumb());
96 addFinger(
"Fingers", 0, 1, _lastGuiValueFingers, _driver->getMaxPosFingers());
98 rootLayoutBuilder.
addChild(
new RemoteGui::VSpacer());
103 _driver->getMaxPosThumb();
104 const float t = _guiTab.
getValue<
float>(
"Thumb").get();
105 const float f = _guiTab.
getValue<
float>(
"Fingers").get();
107 bool updateT = t != _lastGuiValueThumb;
108 bool updateF = f != _lastGuiValueFingers;
109 _lastGuiValueThumb = t;
110 _lastGuiValueFingers = f;
112 if (updateT && updateF)
134 _remoteGuiPrx->createTab(
"KITProstheticHandUnit", rootLayout);
150 for (
const auto& pair : targetJointAngles)
152 if (pair.first ==
"Fingers")
155 static_cast<std::uint64_t
>(pair.second * _driver->getMaxPosFingers()),
156 0ul, _driver->getMaxPosFingers());
158 _driver->sendFingerPWM(200, 2999, pos);
160 std::this_thread::sleep_for(std::chrono::milliseconds(100));
162 else if (pair.first ==
"Thumb")
165 static_cast<std::uint64_t
>(pair.second * _driver->getMaxPosThumb()),
166 0ul, _driver->getMaxPosThumb());
168 _driver->sendThumbPWM(200, 2999, pos);
170 std::this_thread::sleep_for(std::chrono::milliseconds(100));
174 ARMARX_WARNING <<
"Invalid HandJointName '" << pair.first <<
"', ignoring.";
182 jointValues[
"Fingers"] = _driver->getFingerPos() * 1.f / _driver->getMaxPosFingers();
183 jointValues[
"Thumb"] = _driver->getThumbPos() * 1.f / _driver->getMaxPosThumb();
189 _shapes[name] = shape;
202 if (std::regex_match(shapeName, std::regex{
"[gG](0|[1-9][0-9]*)"}))
204 _driver->sendGrasp(std::stoul(shapeName.substr(1)));
206 else if (shapeName ==
"Open")
208 _driver->sendGrasp(0);
210 else if (shapeName ==
"Close")
212 _driver->sendGrasp(1);
214 else if (!_shapes.count(shapeName))
217 <<
"'\nKnown shapes: " << _shapes;
void onInitHandUnit() override
The Variant class is described here: Variants.
detail::VBoxLayoutBuilder makeVBoxLayout(std::string const &name="")
SingleTypeVariantListPtr shapeNames
List containing the names of all valid shapes.
detail::HBoxLayoutBuilder makeHBoxLayout(std::string const &name="")
void addShape(const std::string &name, const std::map< std::string, float > &shape)
void setShape(const std::string &shapeName, const Ice::Current &c=Ice::emptyCurrent) override
detail::LabelBuilder makeLabel(std::string const &name)
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
void setString(const std::string &s, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to s.
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
detail::LabelBuilder makeTextLabel(std::string const &text)
void onStartHandUnit() override
void onExitHandUnit() override
double clamp(double x, double a, double b)
bool empty(const std::string &s)
std::shared_ptr< Value > value()
Derived & addChild(WidgetPtr const &child)
detail::FloatSliderBuilder makeFloatSlider(std::string const &name)
const std::string & to_string(const std::string &s)
ValueProxy< T > getValue(std::string const &name)
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
set(LIBS ArmarXCoreInterfaces ${CMAKE_THREAD_LIBS_INIT} ${dl_LIBRARIES} ${rt_LIBRARIES} ${QT_LIBRARIES} ${Boost_LIBRARIES} BoostAssertionHandler ArmarXCPPUtility SimoxUtility) set(LIB_FILES ArmarXManager.cpp ArmarXMultipleObjectsScheduler.cpp ArmarXObjectScheduler.cpp ManagedIceObject.cpp ManagedIceObjectPlugin.cpp Component.cpp ComponentPlugin.cpp IceGridAdmin.cpp ArmarXObjectObserver.cpp IceManager.cpp PackagePath.cpp RemoteReferenceCount.cpp logging/LoggingUtil.cpp logging/Logging.cpp logging/LogSender.cpp logging/ArmarXLogBuf.cpp system/ArmarXDataPath.cpp system/DynamicLibrary.cpp system/ProcessWatcher.cpp system/FactoryCollectionBase.cpp system/cmake/CMakePackageFinder.cpp system/cmake/CMakePackageFinderCache.cpp system/cmake/ArmarXPackageToolInterface.cpp system/RemoteObjectNode.cpp services/sharedmemory/HardwareId.cpp services/tasks/RunningTask.cpp services/tasks/ThreadList.cpp services/tasks/ThreadPool.cpp services/profiler/Profiler.cpp services/profiler/FileLoggingStrategy.cpp services/profiler/IceLoggingStrategy.cpp application/Application.cpp application/ApplicationOptions.cpp application/ApplicationProcessFacet.cpp application/ApplicationNetworkStats.cpp application/properties/PropertyUser.cpp application/properties/Property.cpp application/properties/PropertyDefinition.cpp application/properties/PropertyDefinitionContainer.cpp application/properties/PropertyDefinitionHelpFormatter.cpp application/properties/PropertyDefinitionConfigFormatter.cpp application/properties/PropertyDefinitionBriefHelpFormatter.cpp application/properties/PropertyDefinitionXmlFormatter.cpp application/properties/PropertyDefinitionDoxygenFormatter.cpp application/properties/PropertyDefinitionDoxygenComponentPagesFormatter.cpp application/properties/PropertyDefinitionContainerBriefHelpFormatter.cpp application/properties/IceProperties.cpp exceptions/Exception.cpp exceptions/local/UnexpectedEnumValueException.cpp util/FileSystemPathBuilder.cpp util/StringHelpers.cpp util/IceReportSkipper.cpp util/Throttler.cpp util/distributed/AMDCallbackCollection.cpp util/distributed/RemoteHandle/ClientSideRemoteHandleControlBlock.cpp util/distributed/RemoteHandle/RemoteHandle.cpp util/distributed/RemoteHandle/RemoteHandleControlBlock.cpp time/ice_conversions.cpp time/json_conversions.cpp time/CallbackWaitLock.cpp time/Clock.cpp time/ClockType.cpp time/ClockTypeNames.cpp time/CycleUtil.cpp time/DateTime.cpp time/Duration.cpp time/Frequency.cpp time/LocalTimeServer.cpp time/Metronome.cpp time/ScopedStopWatch.cpp time/StopWatch.cpp time/Timer.cpp time/TimeKeeper.cpp time/TimeUtil.cpp csv/CsvWriter.cpp csv/CsvReader.cpp eigen/conversions.cpp eigen/ice_conversions.cpp) set(LIB_HEADERS ArmarXManager.h ArmarXDummyManager.h ArmarXMultipleObjectsScheduler.h ArmarXObjectObserver.h ArmarXObjectScheduler.h ArmarXFwd.h Component.h ComponentPlugin.h ComponentFactories.h CoreObjectFactories.h IceGridAdmin.h IceManager.h IceManagerImpl.h json_conversions.h ManagedIceObject.h ManagedIceObjectPlugin.h ManagedIceObjectImpl.h ManagedIceObjectDependency.h ManagedIceObjectRegistryInterface.h PackagePath.h RemoteReferenceCount.h system/ImportExport.h system/ImportExportComponent.h system/AbstractFactoryMethod.h system/FactoryCollectionBase.h system/Synchronization.h system/ArmarXDataPath.h system/DynamicLibrary.h system/ProcessWatcher.h system/ConditionSynchronization.h system/cmake/CMakePackageFinder.h system/cmake/CMakePackageFinderCache.h system/cmake/FindPackageX.cmake system/cmake/ArmarXPackageToolInterface.h system/RemoteObjectNode.h logging/LoggingUtil.h logging/LogSender.h logging/Logging.h logging/ArmarXLogBuf.h logging/SpamFilterData.h services/tasks/RunningTask.h services/tasks/PeriodicTask.h services/tasks/ThreadList.h services/tasks/TaskUtil.h services/tasks/ThreadPool.h services/sharedmemory/SharedMemoryProvider.h services/sharedmemory/SharedMemoryConsumer.h services/sharedmemory/IceSharedMemoryProvider.h services/sharedmemory/IceSharedMemoryConsumer.h services/sharedmemory/HardwareIdentifierProvider.h services/sharedmemory/HardwareId.h services/sharedmemory/exceptions/SharedMemoryExceptions.h services/profiler/Profiler.h services/profiler/LoggingStrategy.h services/profiler/FileLoggingStrategy.h services/profiler/IceLoggingStrategy.h application/Application.h application/ApplicationOptions.h application/ApplicationProcessFacet.h application/ApplicationNetworkStats.h application/properties/forward_declarations.h application/properties/Properties.h application/properties/Property.h application/properties/PluginEigen.h application/properties/PluginEnumNames.h application/properties/PluginCfgStruct.h application/properties/PluginAll.h application/properties/PropertyUser.h application/properties/PropertyDefinition.h application/properties/PropertyDefinition.hpp application/properties/PropertyDefinitionInterface.h application/properties/PropertyDefinitionContainer.h application/properties/PropertyDefinitionFormatter.h application/properties/PropertyDefinitionContainerFormatter.h application/properties/PropertyDefinitionConfigFormatter.h application/properties/PropertyDefinitionHelpFormatter.h application/properties/PropertyDefinitionBriefHelpFormatter.h application/properties/PropertyDefinitionXmlFormatter.h application/properties/PropertyDefinitionDoxygenFormatter.h application/properties/PropertyDefinitionDoxygenComponentPagesFormatter.h application/properties/PropertyDefinitionContainerBriefHelpFormatter.h application/properties/ProxyPropertyDefinition.h application/properties/IceProperties.h exceptions/Exception.h exceptions/LocalException.h exceptions/local/DynamicLibraryException.h exceptions/local/ExpressionException.h exceptions/local/FileIOException.h exceptions/local/InvalidPropertyValueException.h exceptions/local/MissingRequiredPropertyException.h exceptions/local/PropertyInheritanceCycleException.h exceptions/local/ProxyNotInitializedException.h exceptions/local/UnexpectedEnumValueException.h exceptions/local/UnmappedValueException.h exceptions/local/ValueRangeExceededException.h exceptions/user/NotImplementedYetException.h rapidxml/rapidxml.hpp rapidxml/rapidxml_print.hpp rapidxml/rapidxml_iterators.hpp rapidxml/rapidxml_utils.hpp rapidxml/wrapper/RapidXmlReader.h rapidxml/wrapper/RapidXmlWriter.h rapidxml/wrapper/DefaultRapidXmlReader.h rapidxml/wrapper/MultiNodeRapidXMLReader.h util/IceBlobToObject.h util/ObjectToIceBlob.h util/FileSystemPathBuilder.h util/FiniteStateMachine.h util/StringHelpers.h util/StringHelperTemplates.h util/algorithm.h util/OnScopeExit.h util/Predicates.h util/Preprocessor.h util/PropagateConst.h util/Registrar.h util/TemplateMetaProgramming.h util/TripleBuffer.h util/IceReportSkipper.h util/Throttler.h util/distributed/AMDCallbackCollection.h util/distributed/RemoteHandle/ClientSideRemoteHandleControlBlock.h util/distributed/RemoteHandle/RemoteHandle.h util/distributed/RemoteHandle/RemoteHandleControlBlock.h util/SimpleStatemachine.h time.h time_minimal.h time/forward_declarations.h time/ice_conversions.h time/json_conversions.h time/CallbackWaitLock.h time/Clock.h time/ClockType.h time/ClockTypeNames.h time/CycleUtil.h time/DateTime.h time/Duration.h time/Frequency.h time/LocalTimeServer.h time/Metronome.h time/ScopedStopWatch.h time/StopWatch.h time/Timer.h time/TimeUtil.h time/TimeKeeper.h csv/CsvWriter.h csv/CsvReader.h eigen/conversions.h eigen/ice_conversions.h ice_conversions.h ice_conversions/ice_conversions_boost_templates.h ice_conversions/ice_conversions_templates.h ice_conversions/ice_conversions_templates.tpp $
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)
void addShapeName(const std::string &name)
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
void setJointAngles(const NameValueMap &targetJointAngles, const Ice::Current &=Ice::emptyCurrent) override
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
This file offers overloads of toIce() and fromIce() functions for STL container types.
NameValueMap getCurrentJointValues(const Ice::Current &) override