Firmware for Arduino | PLEN Project Company Inc.
Soul.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #ifndef PLEN2_SOUL_H
11 #define PLEN2_SOUL_H
12 
13 
14 #include <stdint.h>
15 
16 namespace PLEN2
17 {
18  class AccelerationGyroSensor;
19  class MotionController;
20 
21  class Soul;
22 }
23 
28 {
29 private:
31  enum { SLOT_GETUP_FACE_UP = 88 };
32 
34  enum { SLOT_GETUP_FACE_DOWN = 89 };
35 
37  enum { MOTIONS_SLOT_BEGIN = 83 };
38 
40  enum { MOTIONS_SLOT_END = 88 };
41 
43  enum { BASE_INTERVAL_MSEC = 15000 };
44 
46  enum { RANDOM_INTERVAL_MSEC = 10000 };
47 
49  enum { GETUP_WAIT_MSEC = 1000 };
50 
52  enum { SAMPLING_INTERVAL_MSEC = 100 };
53 
55  enum { GRAVITY_AXIS_THRESHOLD = 13000 };
56 
57  void m_preprocess();
58 
59 
60  uint32_t m_before_user_action_msec;
61  uint32_t m_next_sampling_msec;
62 
63  uint32_t m_action_interval;
64 
65  bool m_lying;
66 
67  uint8_t m_log_count;
68 
69  AccelerationGyroSensor* m_sensor_ptr;
70  MotionController* m_motion_ctrl_ptr;
71 
72 public:
79  Soul(AccelerationGyroSensor& sensor, MotionController& motion_ctrl);
80 
84  void log();
85 
91  void userActionInputed();
92 
96  void action();
97 };
98 
99 #endif // PLEN2_SOUL_H
Definition: AccelerationGyroSensor.h:16
void action()
Apply appropriate motion based on logging state.
The class which makes natural moving, for PLEN.
Definition: Soul.h:27
Soul(AccelerationGyroSensor &sensor, MotionController &motion_ctrl)
Constructor.
Management class of a motion.
Definition: MotionController.h:36
void userActionInputed()
Log a timing when a user action is input.
Management class of acceleration and gyro sensor.
Definition: AccelerationGyroSensor.h:24
void log()
Log PLEN's state.