Hello! I am rebuilding an old APMBoat from a few years ago, and at the time was unable to find a way to get the boat to hold position. When it reached the final waypoint, it would just stop and float with the current/wind. The only thing I was able to do is have it change speed and repeat a pattern with the DO_JUMP command very slowly. 

But that wastes power - is there a way to get it to return to a location if it drifts a set distance away? 

I was thinking I would use a geofence, but it looks like that capability is not implemented iwth APMRover. 

Any workarounds, suggestions? 


Views: 5699

Replies to This Discussion


What do you think also of a possibility to RTL to home position by the same previous way?

On sea you can have many obstacles (buoy, boat, jetty and so) preventing a direct RTL to home position.

Regarding the rally point, RTL to the nearest, seem the best and secure idea.


@jean-luc, this is the breadcrumb functionality you are talking about.  Copter's are very interested in this too and there has been lots of discussion in various places.  Its actually more complex then it seems but it is on the list albeit not very high.

Thanks, Grant.

So you would be driving/sailing along, go into RTL and the vehicle would go to the nearest Rally point?  This is what Plane can be configured to do now - is it what your saying?

Thanks, Grant.



I can implement any new feature like geofencing, hold position building math-phys model to control a drone in 3D virtual environment, test in wind tunnel and get new feature finally implemented into real drone model.

The issue is new hot features get things more and more complicated and processor's power is not unlimited and building DroneOS new features, add-ons are sacrificed to get basic operational safety working (fail-safe).

Just imagine my 10" Android tablet is your Top Drone.

If I install many applications and let them run in parallel I am low on memory and

Android starts to crash, stall, entering into self-reset mode.

Implementing 10+ more sensors, 10+ Hot add-ons can make DroneOS to crash easily

not to speak about battery health management.

Tethering a drone to make it fly for hours is a nice testing procedure, already implemented.

Grant, just my vision for the RTL mode on sea:

When the boat go in RTL mode (by failsafe or by remote action), there are two possibility for the boat:

-If the Rally point exist, it's going to the nearest rally point and waits in loiter mode.

-If the Rally point do not exist, the boat stop and waits in loiter mode.

Then, if we want to see the boat come back to the home position in RTL mode, we just need to create a Rally point at our home position.



I disagree.  If the Rally point doesn't exist the boat does a RTL.  There may be times a GCS is not being used, therefore, coming home would be the only option.  No GCS, no ability to program a Rally point.


David R. Boulanger


I was thinking of an automatic Rally point generated at the boat position, when this one switches to RTL mode in case of failsafe.



I believe as the code is now when you first arm, a home location is generated for your RTL location.


David R. Boulanger

Linked are a couple of papers from Florida Atlantic University that present a station keeping PID controller that uses GPS and heading sensor inputs.  They were tested off-shore in the Gulf Stream in small craft with good results.  Looks simple to implement as they use X and Y errors driven by the prevailing wind and seas to generate a desired heading.  Then the distance and heading error, and the heading change rate are used as inputs to the control algorithm for throttle and rudder/engine angle control.



Hi Steve, nice papers. But nothing looks simple to implement. 1. No wind, no ocean current - problem solved 2. Unlimited energy supply - problem solved 3. No ocean current, wind only, direction and speed known you control your motor boat like a sail boat 4. No wind, ocean current only, build underwater boat since over water part is not relevant Since energy source is limited I would start from energy management algorithm to meet the target (hold position of the boat/station against wind/current) Since wind direction/heading can be sensed and calculated on-the-fly I would start from developing ocean current reliable sensor/s. Free floating probes could do the job (GPS/radio link for data transmission) Ok, geolocation of the target is fixed and geolocation of your boat is exactly the same, motors are off to let us test your algorithms (reverse control simulation) in case of free floating boat. Floating against the wind, against the current

I think you're missing how a proportion-derivative-integral (PID) controller works, what the inputs are to this particular controller, and how those input are driven by the system and the environment.  The wind and water current will push the USV off the desired station keeping position, developing an X-Y position error with the actual position from the USV GPS.  The X, Y position error generates a desired heading and a heading error, using the USV compass, to get back to the station keeping point, and a distance back to that same point.  Then a thrust command is generated from the position error, and a rudder angle command is generated from the heading error.  The PID structure of the controller minimizes the station keeping error, to the point where the USV could effectively hover on a point with continuous low-level thrust and rudder commands, even with variable wind and current conditions.  The force vector sum of the wind resistance and the water current will be countered by the thrust command, with the rudder commands holding the bow into the direction of the vector sum.  No additional sensors are needed beyond the GPS and the compass that the USV already has.  And like I said in my first post, this controller has been tested on real boats in real off-shore conditions in the Gulf Stream, so it does work without additional sensors.


Now, energy optimization is a different matter that these papers didn't get into.  The integral controller in the controller presented here would drive a continuous, low-level thrust and rudder, which may be the optimum.  However, if that were not the optimum for energy usage, an algorithm could be laid over this controller that would allow the USV to drift a given amount and then drive with an optimum thrust back to the station keeping point before shutting down to drift again.

For what he wants, just a simple heading towards the waypoint and throttle proportional to the distance would be enough.

He isn't after station keeping for an oil drilling platform, just something so the boat doesn't float out to sea.


Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service