EmergencyStop.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package ArmarXCore::ArmarXObjects::EmergencyStop
17  * @author Stefan Reither ( stef dot reither at web dot de )
18  * @date 2016
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "EmergencyStop.h"
24 
25 
26 namespace armarx
27 {
28  void EmergencyStopMaster::setEmergencyStopState(EmergencyStopState state, const ::Ice::Current&)
29  {
30  this->emergencyStopState = state;
31  std::string s;
32  switch (state)
33  {
34  case EmergencyStopState::eEmergencyStopActive :
35  s = "eEmergencyStopActive";
36  break;
37  case EmergencyStopState::eEmergencyStopInactive :
38  s = "eEmergencyStopInactive";
39  break;
40  default:
41  s = "(Unknown)";
42  }
43 
44  ARMARX_INFO_S << "Setting EmergencyStopState to " << s;
45  this->emergencyStopTopic->reportEmergencyStopState(state);
46  }
47 
48  EmergencyStopState EmergencyStopMaster::getEmergencyStopState(const ::Ice::Current&) const
49  {
50  return this->emergencyStopState;
51  }
52 
54  {
55  armarx::ManagedIceObject::offeringTopic(getProperty<std::string>("EmergencyStopTopic").getValue());
56  }
57 
58 
60  {
61  emergencyStopTopic = armarx::ManagedIceObject::getTopic<EmergencyStopListenerPrx>(getProperty<std::string>("EmergencyStopTopic").getValue());
62 
63  // Default state is inactive
64  this->setEmergencyStopState(EmergencyStopState::eEmergencyStopInactive);
65  }
66 
68  {
71  }
72 }
EmergencyStop.h
armarx::EmergencyStopMaster::getEmergencyStopState
EmergencyStopState getEmergencyStopState(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: EmergencyStop.cpp:48
armarx::EmergencyStopPropertyMasterDefinitions
Definition: EmergencyStop.h:47
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
armarx::ManagedIceObject::offeringTopic
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
Definition: ManagedIceObject.cpp:290
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::EmergencyStopMaster::onConnectComponent
void onConnectComponent() override
Definition: EmergencyStop.cpp:59
ARMARX_INFO_S
#define ARMARX_INFO_S
Definition: Logging.h:195
armarx::EmergencyStopMaster::onInitComponent
void onInitComponent() override
Definition: EmergencyStop.cpp:53
armarx::EmergencyStopMaster::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: EmergencyStop.cpp:67
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::EmergencyStopMaster::setEmergencyStopState
void setEmergencyStopState(EmergencyStopState state, const ::Ice::Current &=Ice::emptyCurrent) override
Sets the state of the EmergencyStop and sends the new state immediatly over the specified topic.
Definition: EmergencyStop.cpp:28