evaalapi demo

  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
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Running auto demo test suite

This is a reloadable trial, so let's start by reloading it to be sure

==>  GET /reload --> 200
0.000,-1.000,3.000,15.000,0.000,0.000,0.000,10.422057;43.718278;1

For official trials, this reload step must be skipped

First, check the state of the trial

==>  GET /state --> 200
0.000,-1.000,3.000,15.000,0.000,0.000,0.000,10.422057;43.718278;1

The return code is the trial state, whose meaning is:
{'trialts': 0.0, 'rem': -1.0, 'V': 3.0, 'S': 15.0, 'p': 0.0, 'h': 0.0, 'pts': 0.0, 'pos': '10.422057;43.718278;1'}
'trialts' is 0, as expected
'rem' is -1, meaning that the trial has not started yet
'pos' is set to the initial position

Trial not started
Waiting for 10.0s...

This is the first data we request, and we are at the start of trial,
where the position is known, so we do not bother sending a position estimate
and moreover we ask for a longer-than-usual horizon, that is, 1s

==>  GET /nextdata?horizon=1 --> 200
ACCE;0.015;17287.341;-2.64559;8.69813;2.78446;3
GYRO;0.016;17287.337;0.27428;-1.10933;-0.18998;3
   ... ___610 lines omitted___ ...   
ACCE;0.997;17288.339;9.10036;9.09557;9.08839;3
AHRS;0.998;17288.339;37.754047;-10.503268;0.110357;0.32226315;-0.08629677;-0.02870600;3

Trial running, 17.909 seconds to timeout
Waiting for 10.0s...

You can freely intermix "state" requests in the flow of "nextdata"
requests.  This may be useful for consistency check, including timeout checks.  This is
possible by looking at the state of the trial:

==>  GET /state --> 200
1.000,7.708,3.000,15.000,1630492019.854,1.000,0.000,10.422057;43.718278;1

The return code is the trial state, whose meaning is:
{'trialts': 1.0, 'rem': 7.708, 'V': 3.0, 'S': 15.0, 'p': 1630492019.854, 'h': 1.0, 'pts': 0.0, 'pos': '10.422057;43.718278;1'}
'trialts' is 1.0, as expected
'rem' is the remaining time until timeout

Trial running, 7.667 seconds to timeout
Waiting for 0.2s...

From now on we keep sending an estimate and ask for new data
in steps of 0.5s.  Since this is the default horizon, we do not set horizon
explicitely in the request, but we only set the estimated position.
Note that the positions are just arbitrary numbers in this demo.

==>  GET /nextdata?position=0.1,0.2,0.3 --> 200
ACCE;1.000;17288.344;9.50259;9.30866;9.68694;3
GYRO;1.001;17288.340;-1.41354;-0.42822;0.66401;3
   ... ___301 lines omitted___ ...   
ACCE;1.496;17288.839;-7.05811;1.88903;7.80749;3
GYRO;1.497;17288.835;-1.69393;-1.06229;-1.42637;3

Trial running, 8.883 seconds to timeout
Waiting for 1.4s...


==>  GET /nextdata?position=1.1,1.2,1.3 --> 200
MAGN;1.501;17288.840;-7.92000;-40.08000;-28.68000;3
GYRO;1.502;17288.840;-1.65911;-0.99266;-1.33596;3
   ... ___302 lines omitted___ ...   
GYRO;1.994;17289.332;-0.60292;2.50699;2.05373;3
MAGN;1.999;17289.337;-2.58000;-32.22000;-40.08000;3

Trial running, 8.851 seconds to timeout
Waiting for 1.4s...


==>  GET /nextdata?position=2.1,2.2,2.3 --> 200
GYRO;2.000;17289.337;-0.66096;2.52593;2.03907;3
ACCE;2.000;17289.341;3.62243;1.94409;4.19704;3
   ... ___307 lines omitted___ ...   
GYRO;2.494;17289.833;1.84481;-2.28403;-1.95233;3
MAGN;2.499;17289.838;-16.86000;-16.08000;-42.48000;3

Trial running, 8.769 seconds to timeout
Waiting for 1.3s...


==>  GET /nextdata?position=3.1,3.2,3.3 --> 200
GYRO;2.500;17289.838;2.08366;-2.17651;-1.79778;3
ACCE;2.500;17289.842;-6.08367;6.66785;17.73146;3
   ... ___303 lines omitted___ ...   
GYRO;2.999;17290.337;-1.89735;0.98533;0.10873;3
ACCE;2.999;17290.341;4.82671;6.61278;5.64553;3

Trial running, 8.847 seconds to timeout
Waiting for 1.3s...


==>  GET /nextdata?position=4.1,4.2,4.3 --> 200
AHRS;3.000;17290.341;53.168777;-4.119133;-5.386374;0.44522214;-0.05311754;-0.05805806;3
ACCE;3.002;17290.346;5.23133;6.93600;5.94720;3
   ... ___302 lines omitted___ ...   
ACCE;3.495;17290.839;-2.20267;0.88107;2.27449;3
GYRO;3.496;17290.835;-3.59861;0.29444;-0.27917;3

Trial running, 8.819 seconds to timeout
Waiting for 1.3s...

You can get the list of estimates set so far at any moment, even though this is mostly useful at the end of trial.  Here it is how it looks after setting 5 estimates:

==>  GET /estimates --> 200
pts,c,h,s,pos
0.000,0.000,0.000,15.000,10.422057;43.718278;1
1.000,1630492030.426,0.500,7.429,0.1,0.2,0.3
1.500,1630492031.962,0.500,7.392,1.1,1.2,1.3
2.000,1630492033.532,0.500,7.322,2.1,2.2,2.3
2.500,1630492034.965,0.500,7.390,3.1,3.2,3.3
3.000,1630492036.489,0.500,7.365,4.1,4.2,4.3

Parsing the last estimate line we get:
{'pts': 3.0, 'c': 1630492036.489, 'h': 0.5, 's': 7.365, 'pos': '4.1,4.2,4.3'}
Trial running, 7.182 seconds to timeout
Waiting for 0.0s...

You can get a log of the trial session, including all received data.  Again, this is mostly useful at end of trial.  Here it is how it looks at this point:

==>  GET /log --> 200
2021-09-01T10:26:59.800 ================ Starting trial
state: 0.000,-1.000,3.000,15.000,0.000,0.000,0.000,10.422057;43.718278;1
2021-09-01T10:26:59.841 <-- evaal.aaloa.org/evaalapi/demo/nextdata?horizon=1
2021-09-01T10:26:59.889 --> 200, trialts=1.000 s=15.000
ACCE;0.015;17287.341;-2.64559;8.69813;2.78446;3
GYRO;0.016;17287.337;0.27428;-1.10933;-0.18998;3
MAGN;0.016;17287.342;7.56000;-26.28000;-39.84000;3
GYRO;0.016;17287.342;0.17776;-1.35429;-0.19364;3
ACCE;0.017;17287.346;-2.82995;8.87052;2.36547;3
AHRS;0.017;17287.346;51.891617;31.498898;-54.021839;0.48601067;0.02620481;-0.28725025;3
ACCE;0.017;17287.351;-2.96402;9.06684;2.32716;3
GYRO;0.017;17287.347;0.09774;-1.57725;-0.19792;3
   ... ___2172 lines omitted___ ...   
GYRO;3.492;17290.830;-3.49598;0.30116;-0.31276;3
ACCE;3.493;17290.834;-2.06620;0.93374;1.75016;3
AHRS;3.493;17290.834;48.873177;-12.005839;1.882339;0.41292584;-0.08844020;-0.02838472;3
ACCE;3.495;17290.839;-2.20267;0.88107;2.27449;3
GYRO;3.496;17290.835;-3.59861;0.29444;-0.27917;3

2021-09-01T10:27:16.534 <-- evaal.aaloa.org/evaalapi/demo/state?
2021-09-01T10:27:16.535 --> 200, trialts=3.500 s=7.365
3.500,8.819,3.000,15.000,1630492036.489,0.500,3.000,4.1,4.2,4.3
2021-09-01T10:27:18.171 <-- evaal.aaloa.org/evaalapi/demo/state?
2021-09-01T10:27:18.171 --> 200, trialts=3.500 s=7.365
3.500,7.182,3.000,15.000,1630492036.489,0.500,3.000,4.1,4.2,4.3

Demo stops here