example_event_client.cpp
Go to the documentation of this file.
1 
12 // Headers in this package
14 
21 ExampleEventClient::ExampleEventClient(ros::NodeHandle nh,ros::NodeHandle pnh) : client_(nh,pnh,"example_state_machine_node")
22 {
23  nh_ = nh;
24  pnh_ = pnh;
29  client_.registerCallback(std::bind(&ExampleEventClient::stopMotor, this),"stop_motor");
30  client_.registerCallback(std::bind(&ExampleEventClient::checkMotor, this),"check_motor");
31  client_.registerCallback(std::bind(&ExampleEventClient::checkRecovery, this),"check_recovery");
36  client_.run();
37 }
38 
40 {
41 
42 }
43 
49 boost::optional<rostate_machine::Event> ExampleEventClient::checkMotor()
50 {
52  {
53  rostate_machine::Event ret;
54  ret.header.stamp = ros::Time::now();
55  ret.trigger_event_name = "motor_disconnected";
56  return ret;
57  }
58  return boost::none;
59 }
60 
61 boost::optional<rostate_machine::Event> ExampleEventClient::checkRecovery()
62 {
64  {
65  rostate_machine::Event ret;
66  ret.header.stamp = ros::Time::now();
67  ret.trigger_event_name = "recovery";
68  return ret;
69  }
70  return boost::none;
71 }
72 
78 boost::optional<rostate_machine::Event> ExampleEventClient::stopMotor()
79 {
80  return boost::none;
81 }
void registerCallback(std::function< boost::optional< rostate_machine::Event >(void)> func, std::string tag)
example implementation using EventClient
boost::optional< rostate_machine::Event > stopMotor()
example Callback function, callback function must be boost::optional<rostate_machine::Event>(void) ty...
boost::optional< rostate_machine::Event > checkRecovery()
ros::Duration getCurrentStateDuration()
boost::optional< rostate_machine::Event > checkMotor()
example Callback function, callback function must be boost::optional<rostate_machine::Event>(void) ty...
static Time now()
ExampleEventClient(ros::NodeHandle nh, ros::NodeHandle pnh)
Construct a new Example Event Client:: Example Event Client object.
rostate_machine::EventClient client_


rostate_machine
Author(s):
autogenerated on Wed Sep 4 2019 05:19:52