Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: 555 timer chip guy on March 15, 2008, 04:11:54 PM
-
I am building a robot that uses GPS to navigate beatwen two points. I need a way for the robot to calculate the heading to take from point 1 to point 2 using latitude, longitude, and a compass heading. I have one formula that I have created that works grate, but it is to complicated for the MCU on the robot to use.
Please help.
-
Why is it too complicated?
Can you post what you have?
Use a compass heading to point the bot in the desired heading.
Then use highschool trig to determine the required driving distance between both current and desired locations.
-
GPS is not that accurate on a small scale to get the heading of a small robot, a car is a different story since it's fast.
I'm trying to use
http://www.sparkfun.com/commerce/product_info.php?products_id=761
but it's more trouble than it's worth
Try this
http://www.sparkfun.com/commerce/product_info.php?products_id=7915
Other than that, have a function that mixes motor speed, and store headings in a signed integer, calculate the difference between current heading and desired heading and plug into the mixing function.
If trig is a problem, generate a lookup table
-
Why is it too complicated?
Can you post what you have?
Use a compass heading to point the bot in the desired heading.
Then use highschool trig to determine the required driving distance between both current and desired locations.
Thats just it I am using a compass for heading But my MCU is not smart enough to do trig.
-
Thats just it I am using a compass for heading But my MCU is not smart enough to do trig.
Ohhhh you mean you know how to do it, but your MCU can't handle it . . .
Get a better MCU :P
AVR, PIC, and ARM can handle it. My Axon can easily handle that, too.
edit:
But my MCU is not smart enough to do trig.
considered using a lookup table?
-
considered using a lookup table?
????????????????? what is a lookup table? ???
-
Each trig function has a base range, or domain. Everything beyond that range is just multiples of pi or repeats of previous values, depending on the function. A lookup table is an array of values that you can use to store this base range. For instance, lets say you were using the "Sine" function to compute your locations. You could create an array variable(lets call it SINLOOKUP) in memory containing the values of the sine function, such that where X is equal to the numerical count of the array (SINLOOKUP[X]), the value of SIN(X) is stored in that spot. Now when you need to know what the sine value is of 47, you just "look up" item number 47 in your array. Basically: SINLOOKUP[X] = sin(X). You can also do the same thing a variety of other ways depending on your processors capabilities.
-
http://www.societyofrobots.com/programming_trigtable.shtml
-
Never mind I got a new MCU that has trig functions built in.
Thanks for all the help.