- Sun Feb 13, 2011 7:07 pm
#120200
From a private email, it would seem you need guidance with both aspects. From what I understand, you want your boat to leave the shore, travel a programable distance perpendicular to the shore, turn 90 degrees, travel 50 feet or so, and then return home.
You boat will have a pot, button, GPS, and a compass both connected to an Arduino. The Arduino will control the rudder and possibly a throttle.
As in all things there are a dozen ways to skin this cat. The simplest will be to start "flying an NDB". In other words just pointing the nose in the direction you want to go to. You will not follow a straight line if you have a current or wind, but the math will be simpler.
Steps:
1) After power on wait till the GPS locks
2) Cache the lat lon
3) Wait for a button press to cache the heading. That will be the direction to travel.
4) At the same time read your pot for the distance to travel.
5) Compute the target location (WP1). This is some yucky math but nothing horrible.
6) Compute the second location (WP2).
7) Wait for a button press to start the trip.
8) Engage the throttle and navigate to WP1. (we can discuss this aspect later)
9) When within a certain distance of WP1, switch to WP2.
10) When within a certain distance of WP2, switch to WP0 (home).
11) When within a certain distance of WP0, switch to manual mode and drive a compass heading (to guarantee you make it back to shore).
12) Operator will shut down the unit when it gets back to shore.
If these are the steps, we can discuss the details. Steps 5, 6, and navigating are the hard nuts. Taking one at a time should be your focus.
Just for kicks, have you looked at the RC plane autopilot project I have seen on the web someplace?