Open laurensvalk opened 10 hours ago
Thanks @afarago , @DrTom, @ggramlich, @MonongahelaCryptidCooperative, @TheWendyPower, @BertLindeman and @FLL-Team-24277 for providing feedback about using the gyro in the past year. As you can see, it has now gone to the next stage with lots of new things to try. Thank you for your consideration!
Impressive Laurens!
Added
hub.imu.reset_heading(0)
and stationary on the print:
print(f"Old: {heading1:7.3f} New: {heading3:7.3f} {hub.imu.stationary()}")
Ran on an not calibrated TechnicHub. Put it flat against the chair, turn it up right and rotate 90 degrees and back and flat again.
[EDIT] collapsed: End of the measurements
Old: 0.003 New: 0.002 False Old: 0.020 New: 0.020 False Old: 0.166 New: 0.163 False Old: 1.150 New: 1.154 False Old: 2.980 New: 2.977 False Old: 3.343 New: 3.352 False Old: 1.234 New: 1.256 False Old: 0.238 New: 0.229 False Old: -0.375 New: -0.365 False Old: -1.437 New: -1.435 False Old: -2.547 New: -2.551 False Old: -3.679 New: -3.663 False Old: -4.705 New: -4.696 False Old: -5.155 New: -5.243 False Old: -4.569 New: -4.768 False Old: -1.747 New: -1.878 False Old: -1.214 New: -1.356 False Old: -0.631 New: -0.778 False Old: -0.643 New: -0.976 False Old: -0.518 New: -1.070 False Old: -0.476 New: -1.365 False Old: -0.457 New: -1.546 False Old: -0.459 New: -1.711 False Old: -0.453 New: -2.403 False Old: -0.520 New: -14.731 False Old: -0.501 New: -11.165 False Old: -0.483 New: -7.026 False Old: -0.542 New: -7.612 False Old: -0.600 New: -9.483 False Old: -0.855 New: -23.168 False Old: -0.981 New: -28.151 False Old: -1.120 New: -28.924 False Old: -1.160 New: -29.621 False Old: -1.178 New: -31.567 False Old: -1.170 New: -25.196 False Old: -1.218 New: 3.472 False Old: -1.373 New: 59.658 False Old: -1.262 New: 74.127 False Old: -1.124 New: 84.129 False Old: -0.935 New: 90.710 False Old: -0.738 New: 91.884 False Old: -0.660 New: 86.631 False Old: -0.561 New: 79.924 False Old: -0.614 New: 25.053 False Old: -0.654 New: 15.859 False Old: -1.101 New: 12.823 False Old: -4.446 New: 7.267 False Old: -11.121 New: -0.569 False Old: -11.378 New: -1.032 False Old: -11.926 New: -1.908 False Old: -11.253 New: -1.260 False Old: -14.396 New: -4.401 False Old: -17.607 New: -7.592 False Old: -16.447 New: -6.475 False Old: -16.207 New: -6.257 False Old: -15.963 New: -6.009 False Old: -14.827 New: -4.857 False Old: -14.328 New: -4.370 False Old: -14.086 New: -4.100 False Old: -16.467 New: -6.438 False Old: -16.829 New: -6.890 False Old: -16.673 New: -6.716 False Old: -15.912 New: -5.949 False Old: -15.517 New: -5.583 False Old: -8.704 New: 1.259 False Old: -8.700 New: 1.260 False Old: -8.668 New: 1.291 False Old: -8.689 New: 1.269 False Old: -8.706 New: 1.251 False Old: -8.725 New: 1.229 False Old: -8.621 New: 1.335 False Old: -8.400 New: 1.559 False Old: -8.438 New: 1.520 False Old: -8.433 New: 1.523 False Old: -8.431 New: 1.523 False Old: -8.430 New: 1.524 False Old: -8.429 New: 1.524 False Old: -8.429 New: 1.524 False Old: -8.428 New: 1.524 False Old: -8.427 New: 1.525 False Old: -8.432 New: 1.520 False Old: -8.432 New: 1.519 False Old: -8.429 New: 1.521 True Old: -8.425 New: 1.526 True Old: -8.420 New: 1.530 True Old: -8.412 New: 1.538 True Old: -8.410 New: 1.539 True Old: -8.410 New: 1.540 True Old: -8.408 New: 1.542 True Old: -8.404 New: 1.545 True Old: -8.404 New: 1.545 True Old: -8.401 New: 1.548 True Old: -8.399 New: 1.550 True Old: -8.398 New: 1.551 True Old: -8.396 New: 1.552 True Old: -8.395 New: 1.554 True Old: -8.394 New: 1.554 True Old: -8.393 New: 1.556 True Old: -8.392 New: 1.556 True Old: -8.390 New: 1.559 True Old: -8.389 New: 1.559 True Old: -8.387 New: 1.561 True Old: -8.387 New: 1.561 True Old: -8.386 New: 1.562 True Old: -8.385 New: 1.564 True Old: -8.383 New: 1.566 True
[EDIT] Next test: the same hub now calibrated. Changed the wait to 1000 msec (too many lines). I see (old) gyro drift and much less (new). In this measurements I see the (new) drift get almost back to zero. The hub is placed on a stone windowsill so more stable than on a table on soft carpet.
Old: 0.000 New: 0.000 True Old: -0.001 New: -0.002 True Old: -0.006 New: -0.006 True Old: -0.009 New: -0.009 True Old: -0.008 New: -0.008 True Old: -0.013 New: -0.011 True Old: -0.009 New: -0.008 True Old: -0.007 New: -0.007 True Old: -0.005 New: -0.004 True Old: -0.008 New: -0.007 True Old: 0.001 New: 0.000 True Old: 0.001 New: -0.000 True Old: 0.004 New: 0.003 True Old: 0.001 New: -0.000 True Old: -0.001 New: -0.004 True Old: -0.000 New: -0.004 True Old: 0.001 New: -0.004 True Old: 0.002 New: -0.004 True Old: 0.000 New: -0.005 True Old: 0.008 New: 0.001 True Old: 0.008 New: 0.000 True Old: 0.008 New: 0.001 True Old: 0.010 New: 0.002 True Old: 0.011 New: 0.001 True Old: 0.012 New: 0.004 True Old: 0.016 New: 0.007 True Old: 0.019 New: 0.009 True Old: 0.014 New: 0.003 True Old: 0.016 New: 0.006 True Old: 0.017 New: 0.007 True Old: 0.022 New: 0.010 True Old: 0.023 New: 0.009 True Old: 0.024 New: 0.010 True Old: 0.026 New: 0.011 True Old: 0.025 New: 0.010 True Old: 0.032 New: 0.017 True Old: 0.039 New: 0.021 True Old: 0.046 New: 0.026 True Old: 0.050 New: 0.026 True Old: 0.051 New: 0.026 True Old: 0.054 New: 0.029 True Old: 0.056 New: 0.028 True Old: 0.050 New: 0.024 True Old: 0.055 New: 0.025 True Old: 0.058 New: 0.026 True Old: 0.062 New: 0.030 True Old: 0.061 New: 0.028 True Old: 0.064 New: 0.030 True Old: 0.067 New: 0.032 True Old: 0.069 New: 0.031 True Old: 0.070 New: 0.029 True Old: 0.070 New: 0.027 True Old: 0.073 New: 0.028 True Old: 0.070 New: 0.023 True Old: 0.072 New: 0.024 True Old: 0.072 New: 0.023 True Old: 0.074 New: 0.025 True Old: 0.077 New: 0.024 True Old: 0.079 New: 0.025 True Old: 0.074 New: 0.020 True Old: 0.063 New: 0.009 True Old: 0.051 New: -0.002 True Old: 0.047 New: -0.006 True Old: 0.038 New: -0.015 True Old: 0.031 New: -0.020 True Old: 0.021 New: -0.030 True Old: 0.015 New: -0.033 True Old: 0.011 New: -0.035 True Old: 0.008 New: -0.037 True Old: -0.002 New: -0.044 True Old: -0.014 New: -0.054 True Old: -0.021 New: -0.059 True Old: -0.027 New: -0.063 True Old: -0.031 New: -0.064 True Old: -0.034 New: -0.064 True Old: -0.036 New: -0.063 True Old: -0.034 New: -0.060 True Old: -0.035 New: -0.058 True Old: -0.034 New: -0.055 True Old: -0.028 New: -0.048 True Old: -0.026 New: -0.044 True Old: -0.027 New: -0.043 True Old: -0.025 New: -0.039 True Old: -0.022 New: -0.036 True Old: -0.020 New: -0.034 True Old: -0.024 New: -0.035 True Old: -0.029 New: -0.038 True Old: -0.033 New: -0.041 True Old: -0.041 New: -0.046 True Old: -0.045 New: -0.048 True Old: -0.047 New: -0.048 True Old: -0.048 New: -0.048 True Old: -0.054 New: -0.052 True Old: -0.057 New: -0.052 True Old: -0.061 New: -0.054 True Old: -0.066 New: -0.058 True Old: -0.066 New: -0.055 True Old: -0.071 New: -0.057 True Old: -0.081 New: -0.065 True Old: -0.081 New: -0.061 True Old: -0.083 New: -0.061 True Old: -0.086 New: -0.061 True Old: -0.088 New: -0.060 True Old: -0.091 New: -0.060 True Old: -0.088 New: -0.056 True Old: -0.095 New: -0.060 True Old: -0.097 New: -0.060 True Old: -0.098 New: -0.059 True Old: -0.096 New: -0.056 True Old: -0.090 New: -0.048 True Old: -0.097 New: -0.052 True Old: -0.093 New: -0.047 True Old: -0.099 New: -0.051 True Old: -0.108 New: -0.056 True Old: -0.117 New: -0.062 True Old: -0.120 New: -0.063 True Old: -0.129 New: -0.068 True Old: -0.132 New: -0.069 True Old: -0.143 New: -0.076 True Old: -0.151 New: -0.081 True Old: -0.155 New: -0.080 True Old: -0.157 New: -0.077 True Old: -0.155 New: -0.072 True Old: -0.154 New: -0.068 True Old: -0.157 New: -0.068 True Old: -0.160 New: -0.068 True Old: -0.157 New: -0.063 True Old: -0.153 New: -0.058 True Old: -0.155 New: -0.058 True Old: -0.156 New: -0.057 True Old: -0.158 New: -0.055 True Old: -0.160 New: -0.056 True Old: -0.164 New: -0.056 True Old: -0.171 New: -0.061 True Old: -0.175 New: -0.063 True Old: -0.182 New: -0.067 True Old: -0.186 New: -0.068 True Old: -0.186 New: -0.065 True Old: -0.191 New: -0.067 True Old: -0.194 New: -0.066 True Old: -0.198 New: -0.067 True Old: -0.199 New: -0.066 True Old: -0.200 New: -0.065 True Old: -0.209 New: -0.069 True Old: -0.213 New: -0.070 True Old: -0.217 New: -0.071 True Old: -0.218 New: -0.069 True Old: -0.217 New: -0.067 True Old: -0.218 New: -0.064 True Old: -0.225 New: -0.068 True Old: -0.225 New: -0.066 True Old: -0.235 New: -0.072 True Old: -0.234 New: -0.067 True Old: -0.233 New: -0.063 True Old: -0.242 New: -0.068 True Old: -0.248 New: -0.069 True Old: -0.251 New: -0.069 True Old: -0.247 New: -0.063 True Old: -0.254 New: -0.065 True Old: -0.257 New: -0.066 True Old: -0.262 New: -0.067 True Old: -0.266 New: -0.067 True Old: -0.270 New: -0.066 True Old: -0.270 New: -0.063 True Old: -0.274 New: -0.065 True Old: -0.273 New: -0.061 True Old: -0.276 New: -0.062 True Old: -0.283 New: -0.065 True Old: -0.287 New: -0.066 True Old: -0.287 New: -0.064 True Old: -0.293 New: -0.065 True Old: -0.294 New: -0.063 True Old: -0.305 New: -0.071 True Old: -0.307 New: -0.070 True Old: -0.308 New: -0.068 True Old: -0.311 New: -0.068 True Old: -0.314 New: -0.068 True Old: -0.320 New: -0.070 True Old: -0.326 New: -0.073 True Old: -0.329 New: -0.072 True Old: -0.333 New: -0.071 True Old: -0.336 New: -0.071 True Old: -0.342 New: -0.072 True Old: -0.348 New: -0.074 True Old: -0.353 New: -0.075 True Old: -0.352 New: -0.071 True Old: -0.355 New: -0.071 True Old: -0.362 New: -0.074 True Old: -0.366 New: -0.075 True Old: -0.368 New: -0.073 True Old: -0.377 New: -0.078 True Old: -0.383 New: -0.079 True Old: -0.391 New: -0.082 True Old: -0.393 New: -0.080 True Old: -0.401 New: -0.085 True Old: -0.400 New: -0.080 True Old: -0.400 New: -0.079 True Old: -0.403 New: -0.076 True Old: -0.408 New: -0.076 True Old: -0.412 New: -0.077 True Old: -0.410 New: -0.073 True Old: -0.406 New: -0.066 True Old: -0.402 New: -0.061 True Old: -0.407 New: -0.064 True Old: -0.403 New: -0.056 True Old: -0.401 New: -0.052 True Old: -0.402 New: -0.051 True Old: -0.402 New: -0.049 True Old: -0.391 New: -0.037 True Old: -0.392 New: -0.036 True Old: -0.387 New: -0.030 True Old: -0.389 New: -0.031 True Old: -0.387 New: -0.028 True Old: -0.392 New: -0.032 True Old: -0.397 New: -0.035 True Old: -0.401 New: -0.036 True Old: -0.409 New: -0.041 True Old: -0.416 New: -0.047 True Old: -0.423 New: -0.052 True Old: -0.432 New: -0.057 True Old: -0.431 New: -0.053 True Old: -0.429 New: -0.050 True Old: -0.435 New: -0.055 True Old: -0.433 New: -0.051 True Old: -0.443 New: -0.056 True Old: -0.450 New: -0.062 True Old: -0.459 New: -0.067 True Old: -0.468 New: -0.071 True Old: -0.473 New: -0.073 True The program was stopped (SystemExit).
What did we do? Until now, when you did
hub.imu.heading()
ordrivebase.use_gyro(True)
, it would only register "flat turns", like driving on a table. But if you lifted the hub or steered across a ramp, you would lose the angle.We updated the algorithms to take full motion into account. In the future,
hub.imu.heading()
will do this by default.Gradual introduction To make sure nobody experiences sudden changes in the middle of the FLL season, we're introducing this gradually. For now,
hub.imu.heading()
will still only register flat turns by default.How can you try it? But if you install the latest nightly firmware, you can now do:
It will work even better if you run the new calibration first. Just once. The results are saved on the hub until you change firmware again.
Copy pastable example
Can I use it with drive bases too?
Yes! As above, "flat turns" will remain default for now. But you can now do:
drivebase.use_gyro(False)
drivebase.use_gyro(True)
. But instead you can now do:drivebase.use_gyro('3D')
to try out the future method.Now it should work better on ramps or when it drives over bumps and obstacles.
Can I use it with block coding?
In the future, this will be the default so no action is needed, whether you use Python or blocks. If you want to try it early with blocks, please let me know and we'll put an example together. Thank you!
What are the limitations? It is still just a gyro without a compass for corrections. If you lift it from a table and make lots of motion and put it back, it's going to be off by a few degrees. But still much less than the "flat" case.
What do we want to know from you? Before we make this the default for everyone, we want to make sure that
hub.imu.heading('3D')
is at least as accurate ashub.imu.heading()
for everyday use like on an FLL table with mostly flat turns.We'd love to know if you want to try this in an FLL or WRO practice session.
If you do the new calibration, please let us know how it went. Just that alone should give you an accuracy bonus.
Thank you for your time!
If you want to do this as a science project with your students, we're happy to help, and answer "interview questions"!