View Full Version : Dual differential odometry video

Graham Stabler
10-19-2006, 01:57 AM
I couldn't resist after getting this working yesterday and then adding some graphics today.

Its basically two quadrature encoders taped together with a wheel attached to each. Position and angle is derived encoder-pulse by encoder-pulse in assembly, that's what all that cordic stuff is about, doing the trig.

Then it is displayed as a sprite on the screen. There is a trail of the last 20 points displayed (the assembly cog doesn't loose track but the graphics is slower) and there is also a vector that pops out of the body showing inclination as per the memsic object demo

here's the video: Dual differential odometry (http://www.youtube.com/watch?v=VhNhFyN0oHw)

Thanks to Chip and Beau for the cordic code mine was based on and some nice ideas on the graphics side from chips object.


p.s. This is for work, probably can't release all code but Cordic stuff will be.

10-19-2006, 05:29 AM
Wow!! This is almost exactly what I was working on.

I have the Trig in Code (BASIC Language) and I have to convert it to something that will work on the propeller... It's nice to see that you have this completed.

I like the video. Thanks for sharing... Any code that you can share please forward it along.
I actually think I'm usind similar Encoders· I have two US DIgial S1-100-B's
Best Regards,

Graham Stabler
10-19-2006, 05:55 AM
Well I'll post the cordic stuff tommorow in this thread, its assembly and you can just drop it in to your program (assuming its assembly also), given a vector length and angle it resolves it into x and y directions.

What is your application if I might ask?


Graham Stabler
10-19-2006, 04:47 PM
Attached is some code that does a cordic, its not a real object but allows you to prove to yourself that the code works and then you can paste it in to your own code. Read the comments if confused, if really confused ask.

A proper object will follow that will allow spin programs to access a cordic cog that will do a number of different operations but often you want raw speed so you may want to just cut and paste the asm.



10-20-2006, 06:34 PM
I know how to do dual odometery, but not the cordic way... and on top of that it is in ASM..needless to say I dont understand the code. http://forums.parallax.com/images/smilies/shakehead.gif

My·project is I'm trying to make a moble robotic platform. I want it to know where it is based on encoder inputs... These encoders will not be attached to the drive wheels but will be free wheeling so just incase the wheels slip I won't accumulate a ton of error.

Anyhow.. I am Using the SX28 the read two encoders and sends that information to the propeller. I know I could us the propeller for the encoders but one of my goals was to interface the SX28 with the propeller. Basically the Propeller receives an accumulated count of encoder ticks. So My input to the Cordic Routine should be (Wheel Diameter * PI ) / EncoderTicks. If I know the distance the left wheel move and the distance the right wheel move. I can calculate (X,Y,Theta).·

Graham Stabler
10-20-2006, 07:49 PM
It doesn't work properly with accululated data, there are several ways of getting the same accumulated data from the different moves, the errors will tend to mount up. For example you get the same data if you turn slightly and go forward as you do if you go forward and then turn slightly but you are indifferent positions.

The cordic routing computes R.Cos(theta) and R.Sin(theta) how you use those functions is up to you, as I was evaluating the position on every single encoder pulse my moves are always made up of little triangles (unless both move in same direction at same exact time) so it helps find the lengths of the triangles. If you do it a different way you may need to process the data differently.


Loopy Byteloose
10-21-2006, 12:11 AM
Quite impressive. I see you are using two servos as rotary senors/encoders.

That is something Beau thought up and I guess only the Propeller can do.

"If you want more fiber, eat the package.· Not enough?· Eat the manual."········

···················· Tropical regards,····· G. Herzog [·黃鶴 ]·in Taiwan

Graham Stabler
10-21-2006, 06:04 AM
No I'm using panel mount quadrature encoders but while I wait for better wheels I have a pair of plastic gears as wheels, they must look a bit like servo disks.

These puppys give me 2000 ppr after decode.

Position seems very accurate so far, I intend to do some acid tests when I get some round wheels :)