gaze  0.1.0
Perform gaze tracking with common webcams.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
experiment.h
1 #ifndef INCLUDE_WHERE_PEOPLE_LOOK_EXPERIMENT_H_
2 #define INCLUDE_WHERE_PEOPLE_LOOK_EXPERIMENT_H_
3 
4 #include <queue>
5 #include <memory>
6 #include <mutex> // NOLINT
7 #include <string>
8 
9 #include "gaze/gaze.h"
10 #include "gtk/gtk.h"
11 
12 #include "where_people_look/config.h"
13 
14 
15 namespace wpl {
16 
45 class Experiment {
46  std::mutex mutex;
47 
48  Config* config;
50  GtkImage* image;
52 
53  // State variables
54  bool is_started = false;
55  bool is_prepared = false;
56  bool is_calibrating = false;
57 
58  // Configuration variables
59  int calibration_after = 50;
60  int calibration_countdown = this->calibration_after;
61  int cooldown = 2000;
62  int pause_duration = 1000;
63  int trial_duration = 3000;
64  int warmup = 2000;
65 
66  void init_gaze_tracker();
67 
68  void read_stimuli_list();
69 
70  static gboolean experiment_stop_trial(gpointer experiment);
71 
72  static gboolean experiment_start_trial(gpointer experiment);
73 
74  public:
81  Experiment(GtkImage* const image, Config* const config);
82 
83  ~Experiment();
84 
88  Config* get_config();
89 
100  void prepare();
101 
108  void start();
110 
111  // TODO(shoeffner): Maybe this should become private?
136  bool trial();
138 
145  static gboolean experiment_calibrate(gpointer experiment);
146 
153  static gboolean experiment_trial(gpointer experiment);
154 
162  static gboolean experiment_quit_program(gpointer experiment);
163 
172  static bool experiment_prepare(const GtkWidget* const assistant,
173  Experiment* const experiment);
174 
185  static bool experiment_start(const GtkWidget* const window,
186  const GdkEventKey* const event_key,
187  Experiment* const experiment);
188 };
189 
190 } // namespace wpl
191 
192 #endif // INCLUDE_WHERE_PEOPLE_LOOK_EXPERIMENT_H_
Experiment(GtkImage *const image, Config *const config)
Definition: experiment.cpp:48
static gboolean experiment_trial(gpointer experiment)
Definition: experiment.cpp:119
static bool experiment_prepare(const GtkWidget *const assistant, Experiment *const experiment)
Definition: experiment.cpp:123
Config * get_config()
Definition: experiment.cpp:57
static bool experiment_start(const GtkWidget *const window, const GdkEventKey *const event_key, Experiment *const experiment)
Definition: experiment.cpp:129
Holds all configuration options for the experiment.
Definition: config.h:15
Implements an experiment flow for Judd et al. (2009) .
Definition: experiment.h:45
static gboolean experiment_calibrate(gpointer experiment)
Definition: experiment.cpp:104
static gboolean experiment_quit_program(gpointer experiment)
Definition: experiment.cpp:111