ev3dev-lang-python icon indicating copy to clipboard operation
ev3dev-lang-python copied to clipboard

MoveDifferential: use gyro support for better accuracy

Open dwalton76 opened this issue 6 years ago • 8 comments

odometry support went in via #235 but the initial commit did not include gyro support

dwalton76 avatar Apr 18 '19 02:04 dwalton76

@WasabiFan in a nutshell do you just use the gryo angle instead of calculating the angle based on the wheel movements?

dwalton76 avatar Apr 18 '19 02:04 dwalton76

ok I watched enough builderdude35 videos on Youtube last night that I think I have my head wrapped around what to do with the gyro in terms of odometry. I think my gryo is busted though, I do things like use MoveDifferential turn_to_angle to turn 90 degrees and the robot looks like it turned exactly 90 degrees but the gyro says it turned 50 degrees.

dwalton76 avatar Apr 21 '19 02:04 dwalton76

The way I would imagine implementing it is to throw the gyro and wheel odometry angle measurements into a Kalman filter (to smooth out the gyro data, primarily) then use the output measurement for calculations. That being said, the noise of the gyro probably isn't huge and both of our measurements are continuously integrated rather than individually sampled, so a Kalman filter might be overkill.

What was the approach you saw?

WasabiFan avatar Apr 21 '19 06:04 WasabiFan

For rotating in place it just used move steering to start rotating and then stopped when the gyro got to the desired angle. They had to underestimate though (aim for 80 degrees to end up turning the desired 90 degrees) so it wasnt crazy impressive. What we have right now (without a gyro) is actually pretty good. I can tell it to torn 90 and it will sometimes hit it dead on but others it will only be off by a degree or two.

dwalton76 avatar Apr 21 '19 12:04 dwalton76

For driving forward in a straight line they used a PID controller to adjust motors to keep the gyro at the original angle. This all looked very cool to me and worked really well in the video. He would have the robot driving straight and then would nudge it with his hand and the robot would straighten itself out

dwalton76 avatar Apr 21 '19 13:04 dwalton76

Having lots of gyro issues right now, filed https://github.com/ev3dev/ev3dev/issues/1262

dwalton76 avatar Apr 21 '19 20:04 dwalton76

Also hitting https://github.com/ev3dev/ev3dev/issues/1269

dwalton76 avatar Apr 26 '19 13:04 dwalton76

We reverted the commit so am re-opening this one

dwalton76 avatar Jan 17 '20 00:01 dwalton76