|
This component provides a software emergency-stop mechanism. More...
Classes | |
class | EmergencyStopMaster |
The EmergencyStopMaster stores the current state of the EmergencyStop and broadcasts any changes to that state over the specified topic. More... | |
class | EmergencyStopNode< T > |
This component listens on the specified topic (default value: EmergencyStop) and changes its state corresponding to the state send over the topic. Furthermore it calls registered functions if their expected state is equal to the one that has been sent. The template-type of an instantiation of this class has to be equal to the type of the object to which any registered function belong. More... | |
This component provides a software emergency-stop mechanism.
The mechanism consists of one EmergencyStopMaster and one or more EmergencyStopNode(s). Every node connects to the master and listens to any changes of the EmergencyStopState send over the specified topic.
The state of the nodes is always identical to the state of the master and can be used in the component that started such a node. Furthermore there is the possibility to register functions of the component directly in the node, which then will be executed immediately when the master changes into the specified state.
Properties:
In most usecases there is no need to change any of the two optional properties: EmergencyStopProxy and EmergencyStopTopic. With their standard values the functionality of one master and many nodes and the button in the ArmarXGui is guaranteed. Only in case there are multiple masters with different states, these additional masters have to get a different proxy-name and topic-name.
Usage:
Example implementation of an EmergencyStopNode in a component:
KinematicUnitArmar4.h:
#include <ArmarXCore/components/EmergencyStop/EmergencyStop.h> class KinematicUnitArmar4 { ... armarx::EmergencyStopNode<KinematicUnitArmar4>::EmergencyStopNodePtr emergencyStopNode; ... }
KinematicUnitArmar4.cpp:
void KinematicUnitArmar4::onInitKinematicUnit() { // // // // Creating an EmergencyStopNode with this class (KinematicUnitArmar4) as template-typ emergencyStopNode = armarx::Component::create < armarx::EmergencyStopNode<KinematicUnitArmar4> >(); // Adding the created node to the ArmarXManager, it is important to use an UUID in the name, because there might // be several nodes this->getArmarXManager()->addObject(emergencyStopNode, false, emergencyStopNode->getDefaultName() + IceUtil::generateUUID()); // Waiting for the node-component to be started emergencyStopNode->getObjectScheduler()->waitForObjectState(armarx::ManagedIceObjectState::eManagedIceObjectStarted); // Register a function of this class in the node emergencyStopNode->registerCallbackFunction(this, &KinematicUnitArmar4::emergencyStopActive, armarx::EmergencyStopState::eEmergencyStopActive); // Getting the current state of the EmergencyStop EmergencyStopState state = emergencyStopNode->getEmergencyStopState(); if (state == armarx::EmergencyStopState::eEmergencyStopActive) { // do something } } void KinematicUnitArmar4::emergencyStopActive() { // do something else }