I am building a rover for a school project that runs on Arduino ardumoto and Adafruit Ultimate GPS shield. I can drive the rover and I can receive the information from the GPS from the great tutorials on this site. My main problem is combining the two functions. My project involves this rover moving from a random GPS coordinate to a predetermined GPS coordinate. I know I need to use bearings and waypoints along with some control logic. I really just don't where to start when it comes to combining the two functions instead of both independently on separate sketches.
Any help would be greatly appreciated.
Rover Help Using Ardumoto and Adafruit Ultimate Shield
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- jfd7851
- Posts: 10
- Joined: Sat Sep 06, 2014 1:52 am
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Rover Help Using Ardumoto and Adafruit Ultimate Shield
Is the GPS your only sensor? Do you have a magnetometer to determine your orientation? What about obstacle avoidance? Is that a requirement as well?
- jfd7851
- Posts: 10
- Joined: Sat Sep 06, 2014 1:52 am
Re: Rover Help Using Ardumoto and Adafruit Ultimate Shield
None of those. Just a GPS.
- jfd7851
- Posts: 10
- Joined: Sat Sep 06, 2014 1:52 am
Re: Rover Help Using Ardumoto and Adafruit Ultimate Shield
I guess to condense my question down, I can summarize it a little more. I want to use the haversine formula to calculate the distance between some points, but I am lost on how I assign the variable of current GPS coordinates and endpoint GPS coordinates within an Arduino sketch. I can see that the Adafruit processes all of the GPS information, but I need to understand how to use the information from the GPS within an Arduino sketch.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Rover Help Using Ardumoto and Adafruit Ultimate Shield
There are a few ways to approach it. If you know the current position and target position, then you know the heading you need to follow to get there. The problem is, you can't calculate heading via GPS unless you are moving. So you start moving.
As you are moving:
1 - you recalculate your current heading.
2 - you recalculate your target heading.
3 - you turn if necessary to correct for any heading error.
- repeat steps 1-3 until you reach your destination.
As you are moving:
1 - you recalculate your current heading.
2 - you recalculate your target heading.
3 - you turn if necessary to correct for any heading error.
- repeat steps 1-3 until you reach your destination.
Please be positive and constructive with your questions and comments.