-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.cc
34 lines (27 loc) · 866 Bytes
/
example.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//-----------------------------------------------------------------------------
#include <unistd.h>
#include <stdio.h>
#include <cstdlib>
#include "example.h"
#include "time_state.h"
#include "point_fsm.h"
//-----------------------------------------------------------------------------
int main(int argc, char **argv){
// Execute only every 1/100 of a second
// so that we don't busy-loop. This 'resolution' will
// have an effect on the accuracy of the state updates,
// and effectively lets the program trade accuracy
// for CPU time.
int ms_resolution = 10;
fprintf(stderr, "\nLaunching with an update resolution of %d ms.\n",ms_resolution);
time_state * timer = new time_state();
point_fsm * point = new point_fsm();
while(1){
timer->run();
point->run();
usleep(ms_resolution * 1000);
}
free(timer);
free(point);
return 0;
}