Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic odometry #36

Open
davidjsherman opened this issue Jan 14, 2018 · 1 comment
Open

Basic odometry #36

davidjsherman opened this issue Jan 14, 2018 · 1 comment

Comments

@davidjsherman
Copy link
Contributor

davidjsherman commented Jan 14, 2018

Odometry on the Thymio II will always be an approximation. However the odometry calculation in thymio_motion.aesl (see formula) has proven to be useful, especially in Scratch integration. The formula used, from [Lucas 2000], is inexpensive and appropriate for the Thymio II.

A simple addition to the firmware could perform this systematically on a variable odo[3] containing x, y, theta. If necessary a further value could be reserved for calibration.

This should be more accurate than the Aesl code it would replace (lines 167–174), in particular by avoiding precision and rounding errors.

An optimized version of this code, updated at 100 Hz, could be added to motor_new_analog.

Users would write to the odo variable to set a known initial position.

@davidjsherman
Copy link
Contributor Author

The Aesl code to replace is:

onevent motor
odo.delta = (motor.right.target + motor.left.target) / 2
call math.muldiv(tmp[0], (motor.right.target - motor.left.target), 3406, 10000)
odo.theta += tmp[0]
call math.cos(tmp[0:1],[odo.theta,16384-odo.theta])
call math.muldiv(tmp[0:1], [odo.delta,odo.delta],tmp[0:1], [32767,32767])
odo.x += tmp[0]/45
odo.y += tmp[1]/45

Maybe using motor.*.speed rather than motor.*.target would be more accurate, but because of the noise in speed it might be better to use a low-pass filter on targetspeed as suggested by [Wang 2013]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant