NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
fallprotection.h
1 // Fall protection for the robot
2 // Authors: Philipp Allgeuer <pallgeuer@ais.uni-bonn.de>
3 // Hafez Farazi <farazi@ais.uni-bonn.de>
4 
5 // Ensure header is only included once
6 #ifndef FALLPROTECTION_H
7 #define FALLPROTECTION_H
8 
9 // Includes
10 #include <robotcontrol/motionmodule.h>
11 #include <robotcontrol/model/robotmodel.h>
12 #include <robotcontrol/FadeTorqueAction.h>
13 #include <actionlib/client/simple_action_client.h>
14 #include <config_server/parameter.h>
15 #include <plot_msgs/plot_manager.h>
16 
17 // Fall protection namespace
18 namespace fall_protection
19 {
25  class FallProtection : public robotcontrol::MotionModule
26  {
27  public:
28  // Constructor/destructor
30  virtual ~FallProtection() {}
31 
32  // Motion module function overrides
33  virtual bool init(robotcontrol::RobotModel* model);
34  virtual bool isTriggered();
35  virtual void step();
36 
37  private:
38  // Constants
39  static const std::string m_lyingPlayStatePrefix;
40  static const std::string m_walkingStatePrefix;
41 
42  // Config server parameters
43  config_server::Parameter<bool> m_fallProtectionEnabled;
44  config_server::Parameter<bool> m_sideGetupsEnabled;
45  config_server::Parameter<bool> m_landingEnabled;
46  config_server::Parameter<bool> m_landingProneEnabled;
47  config_server::Parameter<bool> m_landingSupineEnabled;
48  config_server::Parameter<float> m_fallTriggerAngle;
49  config_server::Parameter<float> m_fallTriggerAngleKick;
50  config_server::Parameter<float> m_fallTriggerAngleRelaxed;
51  config_server::Parameter<float> m_sideGetupRollAngle;
52  config_server::Parameter<float> m_maxLandingDuration;
53  config_server::Parameter<float> m_angleToRelaxAfterLanding;
54  config_server::Parameter<float> m_maxRollForLanding;
55 
56  // Robot states
57  robotcontrol::RobotModel::State m_state_relaxed;
58  robotcontrol::RobotModel::State m_state_setting_pose;
59  robotcontrol::RobotModel::State m_state_init;
60  robotcontrol::RobotModel::State m_state_standing;
61  robotcontrol::RobotModel::State m_state_sitting;
62  robotcontrol::RobotModel::State m_state_kicking;
63  robotcontrol::RobotModel::State m_state_falling;
64  robotcontrol::RobotModel::State m_state_getting_up;
65  robotcontrol::RobotModel::State m_state_lying_prone;
66  robotcontrol::RobotModel::State m_state_lying_supine;
67  robotcontrol::RobotModel::State m_state_lying_side;
68  robotcontrol::RobotModel::State m_state_lying_biased;
69  robotcontrol::RobotModel::State m_state_lying_side_left_prone;
70  robotcontrol::RobotModel::State m_state_lying_side_left_supine;
71  robotcontrol::RobotModel::State m_state_lying_side_right_prone;
72  robotcontrol::RobotModel::State m_state_lying_side_right_supine;
73  robotcontrol::RobotModel::State m_state_landing_prone;
74  robotcontrol::RobotModel::State m_state_landing_supine;
75 
76  // Fade torque action client
77  actionlib::SimpleActionClient<robotcontrol::FadeTorqueAction> m_fadeTorqueAction;
78 
79  // Falling state enumeration
80  enum FallingState
81  {
82  FS_NONE = 0,
83  FS_TRIGGERED,
84  FS_LANDING_PRONE,
85  FS_LANDING_SUPINE,
86  FS_RELAXED,
87  FS_COUNT
88  };
89 
90  // Internal variables
91  bool m_enabled;
92  double m_currentAngle;
93  bool m_relaxLock;
94  bool m_fall_triggered;
95  ros::Time m_triggerTime;
96  bool m_useLanding;
97  bool m_isLanding;
98  FallingState m_fallingState;
99 
100  // Plot manager
101  enum PMIds
102  {
103  PM_FALLING_STATE = 0,
104  PM_COUNT
105  };
106  plot_msgs::PlotManagerFS m_PM;
107  };
108 }
109 
110 #endif /* FALLPROTECTION_H */
111 // EOF
Motion module that provides fall protection for the robot.
Definition: fallprotection.h:25