NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sitting_demo_actions.h
1 // Actions for the sitting demo motion demonstration state machine
2 // Author: Philipp Allgeuer <pallgeuer@ais.uni-bonn.de>
3 
4 // Ensure header is only included once
5 #ifndef SITTING_DEMO_ACTIONS_H
6 #define SITTING_DEMO_ACTIONS_H
7 
8 // Defines - Joint names
9 #define NAME_HEAD_PITCH "head_pitch"
10 #define NAME_HEAD_YAW "neck_yaw"
11 #define NAME_LEFT_SHOULDER_PITCH "left_shoulder_pitch"
12 #define NAME_LEFT_SHOULDER_ROLL "left_shoulder_roll"
13 #define NAME_LEFT_ELBOW_PITCH "left_elbow_pitch"
14 #define NAME_RIGHT_SHOULDER_PITCH "right_shoulder_pitch"
15 #define NAME_RIGHT_SHOULDER_ROLL "right_shoulder_roll"
16 #define NAME_RIGHT_ELBOW_PITCH "right_elbow_pitch"
17 #define NAME_LEFT_KNEE_PITCH "left_knee_pitch"
18 #define NAME_LEFT_ANKLE_PITCH "left_ankle_pitch"
19 #define NAME_LEFT_ANKLE_ROLL "left_ankle_roll"
20 #define NAME_RIGHT_KNEE_PITCH "right_knee_pitch"
21 #define NAME_RIGHT_ANKLE_PITCH "right_ankle_pitch"
22 #define NAME_RIGHT_ANKLE_ROLL "right_ankle_roll"
23 
24 // Defines - Default seated position
25 #define DSP_HEAD_PITCH 0.00
26 #define DSP_HEAD_YAW 0.00
27 #define DSP_LEFT_SHOULDER_PITCH -0.26
28 #define DSP_LEFT_SHOULDER_ROLL 0.00
29 #define DSP_LEFT_ELBOW_PITCH -0.74
30 #define DSP_RIGHT_SHOULDER_PITCH -0.26
31 #define DSP_RIGHT_SHOULDER_ROLL 0.00
32 #define DSP_RIGHT_ELBOW_PITCH -0.74
33 #define DSP_LEFT_KNEE_PITCH 0.80
34 #define DSP_LEFT_ANKLE_PITCH 0.00
35 #define DSP_LEFT_ANKLE_ROLL 0.00
36 #define DSP_RIGHT_KNEE_PITCH 0.80
37 #define DSP_RIGHT_ANKLE_PITCH 0.00
38 #define DSP_RIGHT_ANKLE_ROLL 0.00
39 
40 // Defines - Random parameter ranges
41 #define MIN_NOTHING_DELAY 2.5
42 #define MAX_NOTHING_DELAY 10.0
43 #define MIN_LEG_DANGLE_TIME 5.0
44 #define MAX_LEG_DANGLE_TIME 20.0
45 #define MIN_HEAD_IDLE_TIME 5.0
46 #define MAX_HEAD_IDLE_TIME 20.0
47 #define MIN_POST_MOTION_DELAY 1.0
48 #define MAX_POST_MOTION_DELAY 4.0
49 #define MIN_NUM_MOTIONS 1
50 #define MAX_NUM_MOTIONS 4
51 
52 // Defines - Misc
53 #define MAIN_FN_DELAY 3.0 // Time to wait at the beginning of the main function before doing anything
54 #define INIT_DELAY 5.0 // Time to wait during initialisation before planning the first action
55 #define PRE_ACTION_DELAY 1.0 // Time to wait (after cessation of all previous motion) before executing a new action
56 #define DEFAULT_EFFORT 0.25 // Default effort to use for normal sitting-based motions
57 #define RETURN_SITTING_VELOCITY 0.60 // Angular velocity with which to return to the default sitting position in the return to sitting state
58 #define RETURN_SITTING_EFFORT 0.10 // Effort with which to return to the default sitting position in the return to sitting state
59 #define LIMB_CONTROL_TIME_BIAS 0.05 // Number of seconds to bias limbControlFinishTime by in order to make reasonably sure limb control is really finished when we query it again
60 
61 // Includes
62 #include <string>
63 
64 // Class forward-declarations
65 namespace statecontroller
66 {
67  class StateQueue;
68 }
69 
70 // Sitting demo namespace
71 namespace sitting_demo
72 {
73  // Class forward-declarations
74  class SittingDemoSC;
75 
76  // Using declarations
78 
79  // Demo actions
80  enum DemoAction
81  {
82  ACT_DO_NOTHING = 0,
83  ACT_LEG_DANGLE,
84  ACT_HEAD_IDLE,
85  ACT_LEG_DANGLE_HEAD_IDLE,
86  ACT_PLAY_MOTIONS,
87  ACT_PLAY_MOTIONS_LD,
88  ACT_PLAY_MOTIONS_HI,
89  ACT_PLAY_MOTIONS_LD_HI,
90  NUM_ACTIONS
91  };
92 
93  // String names of demo actions
94  const std::string DemoActionName[NUM_ACTIONS + 1] =
95  {
96  "DO_NOTHING",
97  "LEG_DANGLE",
98  "HEAD_IDLE",
99  "LEG_DANGLE_HEAD_IDLE",
100  "PLAY_MOTIONS",
101  "PLAY_MOTIONS_LD",
102  "PLAY_MOTIONS_HI",
103  "PLAY_MOTIONS_LD_HI",
104  "NUM_ACTIONS"
105  };
106 
107  // Sitting demo action class
108  class SittingDemoAction
109  {
110  public:
111  // Static action functions
112  static void ActDoNothing(SittingDemoSC* sc, StateQueue* Q);
113  static void ActLegDangle(SittingDemoSC* sc, StateQueue* Q);
114  static void ActHeadIdle(SittingDemoSC* sc, StateQueue* Q);
115  static void ActLegDangleHeadIdle(SittingDemoSC* sc, StateQueue* Q);
116  static void ActPlayMotions(SittingDemoSC* sc, StateQueue* Q);
117  static void ActPlayMotionsLD(SittingDemoSC* sc, StateQueue* Q);
118  static void ActPlayMotionsHI(SittingDemoSC* sc, StateQueue* Q);
119  static void ActPlayMotionsLDHI(SittingDemoSC* sc, StateQueue* Q);
120  };
121 }
122 
123 #endif /* SITTING_DEMO_ACTIONS_H */
124 // EOF
Implements a dynamic State queue.
Definition: state_controller.h:522