BootState.cpp
Go to the documentation of this file.
1 #include <rsm_core/BootState.h>
2 
3 namespace rsm {
4 
6 }
7 
9 }
10 
12  //initialize services, publisher and subscriber
13  ros::NodeHandle nh("rsm");
14  _bootupClient = nh.serviceClient<std_srvs::SetBool>("bootUpFinished");
15  //initialize variables
16  _name = "Boot";
17 }
18 
20 }
21 
23  //Request if boot was finished
24  std_srvs::SetBool srv;
25  srv.request.data = true;
26  if (_bootupClient.call(srv)) {
27  if (srv.response.success) {
29  boost::make_shared<IdleState>());
30  }
31  } else {
32  ROS_ERROR("Failed to call service Bootup Finished");
33  }
34 }
35 
37 }
38 
39 void BootState::onExplorationStart(bool &success, std::string &message) {
40  success = false;
41  message = "Still booting";
42 }
43 
44 void BootState::onExplorationStop(bool &success, std::string &message) {
45  success = false;
46  message = "Still booting";
47 }
48 
50  std::string &message) {
51  success = false;
52  message = "Still booting";
53 }
54 
55 void BootState::onInterrupt(int interrupt) {
56  if (interrupt == EMERGENCY_STOP_INTERRUPT) {
58  boost::make_shared<EmergencyStopState>());
59  _interrupt_occured = true;
60  }
61 }
62 
63 }
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
void onExplorationStop(bool &success, std::string &message)
Called when exploration was stopped manually.
Definition: BootState.cpp:44
void onInterrupt(int interrupt)
Called when an operation mode interrupt was received.
Definition: BootState.cpp:55
void onActive()
Process method (step-wise, never block this method)
Definition: BootState.cpp:22
bool call(MReq &req, MRes &res)
void transitionToVolatileState(boost::shared_ptr< rsm::BaseState > next_state)
BootState()
Constructor.
Definition: BootState.cpp:5
bool _interrupt_occured
Shows if an interupt occured.
Definition: BaseState.h:129
void onExit()
Called once when left.
Definition: BootState.cpp:36
void onWaypointFollowingStartStop(bool &success, std::string &message)
Definition: BootState.cpp:49
Definition: BaseState.h:8
void onSetup()
Called once when registered at StateInterface.
Definition: BootState.cpp:11
std::string _name
Name of the state.
Definition: BaseState.h:133
ros::ServiceClient _bootupClient
Definition: BootState.h:72
StateInterface * _stateinterface
Pointer to State Interface handling all state transitions.
Definition: BaseState.h:125
~BootState()
Destructor.
Definition: BootState.cpp:8
#define EMERGENCY_STOP_INTERRUPT
Definition: BaseState.h:11
void onEntry()
Called once when activated.
Definition: BootState.cpp:19
void onExplorationStart(bool &success, std::string &message)
Definition: BootState.cpp:39
#define ROS_ERROR(...)


rsm_core
Author(s): Marco Steinbrink
autogenerated on Tue Mar 16 2021 02:44:31