NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hand_shaking_demo.h
1 // Hand shaking demonstration on a standing robot
2 // Authors: Philipp Allgeuer <pallgeuer@ais.uni-bonn.de>
3 
4 // Ensure header is only included once
5 #ifndef HAND_SHAKING_DEMO_H
6 #define HAND_SHAKING_DEMO_H
7 
8 // Includes
9 #include <nimbro_op_interface/Button.h>
10 #include <config_server/parameter.h>
11 #include <robotcontrol/State.h>
12 #include <ros/service.h>
13 #include <ros/time.h>
14 
15 // Hand shaking demo namespace
16 namespace hand_shaking_demo
17 {
18  // HandShakingDemo class
19  class HandShakingDemo
20  {
21  public:
22  // Constructor/destructor
23  HandShakingDemo();
24 
25  // Main loop step
26  bool step();
27  bool halt();
28 
29  // Get functions
30  inline bool enabled() const { return m_handShakingDemoEnabled(); }
31 
32  private:
33  // ROS services
34  ros::ServiceClient m_srv_playMotion;
35 
36  // ROS topics
37  ros::Subscriber m_sub_button;
38 
39  // Motions
40  void playMotion(const std::string& motionName);
41 
42  // Button presses
43  void handleButton(const nimbro_op_interface::ButtonConstPtr& msg);
44  bool m_buttonPressed;
45 
46  // Robotcontrol robot state
47  ros::Subscriber m_sub_robotState;
48  void handleRobotState(const robotcontrol::StateConstPtr& msg);
49  std::string m_robotStateName;
50  bool m_robotIsStanding;
51  bool m_robotIsShaking;
52 
53  // Configuration parameters
54  config_server::Parameter<bool> m_handShakingDemoEnabled;
55  void handleDemoEnabled();
56 
57  // Internal variables
58  ros::Time m_curStepTime;
59  };
60 }
61 
62 #endif /* HAND_SHAKING_DEMO_H */
63 // EOF
boost::shared_ptr< State const > StateConstPtr
Used to represent a Boost shared pointer to a constant State object.
Definition: state_controller.h:413