Actively loitering issue with rover 3.2

I have a boat with skid steering configuration running rover 3.2. I was trying loiter_time and loiter_unlim and was expecting the boat drifting out of WP_RADIUS (0.5m) and then engaged the motors and returning to the loiter position. Instead the boat was constantly circling the WP (see picture).


Can someone point me to the right configuration or give me a hint what I may do wrong?
Thanks a lot

Hi Matthias,

Thanks for the report. There’s currently no way to make it behave as you’d like but it’s not a very difficult code change I think. I’ve raised an issue including what the code change that should achieve what you want here: https://github.com/ArduPilot/ardupilot/issues/7645.

So it’s a matter of trying this out and testing it. I can’t immediately promise to take this on but perhaps someone else can make the change and make a binary available for you. You’re using a Pixhawk or Pixhawk2/Cube or something else?

P.S. I changed the category on this report to “Rover 3.2”

Thanks a lot.
I am using a Pixracer at the moment. I am keen to start looking into the code my self but I am a newbi (just did a lot with matlab).

This used to work ok. I think your WP_RADIUS of 0.5m is too tight. Try 2m or 3m and see what happens.

Thanks, Grant.

Hi rmackay9,
we successfully implemented “Rover: boats should drift when within WP_RADIUS of waypoint” from your link: https://github.com/ArduPilot/ardupilot/issues/7645
The test results can be review in the log: https://www.dropbox.com/s/vstuh8knq3js6v7/2018-02-03%2010-49-10.zip?dl=0
A quick video from the test yesterday with our experimental platform can be viewed here: https://www.youtube.com/watch?v=AyS4XYoUNZE
@gmorghp: you are right about the WP_RADIUS: with 0.5m there was circling and with 2m correct drift

Way forward: We would like to achieve something like active weathervaning like for VTOL planes. http://ardupilot.org/plane/docs/quadplane-weathervaning.html
The Idea could be:

  • for the boat design: while drifting the boat should self weathervaning
  • for the loiter-function: EKF could fusion a windsensor. This would help the boat to weathervaning properly
  • for the loiter-function: a dedicated LOITER_SPEED should be tunable which would be much lower than WP_SPEED
  • for the loiter-function: maybe we could have two WP_RADIUS. One small radius (<1m) were the boat would drift and one were the weathervaning would actuate

Thanks for any thought on that

1 Like

Matthias,

Love the video! Nicely done implementing the change. I didn’t see your reply before I went ahead and created this PR (Rover: boats always navigate when outside waypoint radius by rmackay9 · Pull Request #7660 · ArduPilot/ardupilot · GitHub) which I suspect is functionally quite similar to what you did. Anyway, if these changes look OK, I’ll pull them into master.

Re weathervaning the new LOITER_SPEED parameter part is not too hard. I’d name it WP_LOIT_SPEED perhaps… starting with “WP_” keeps it closer to other parameters related to waypoint / Auto mode navigation. Inside of mode_auto.cpp, where it makes calls like this:

calc_throttle(calc_reduced_speed_for_turn_or_distance(_reversed ? -_desired_speed : _desired_speed), true);

instead of _desired_speed we would want to pass in the new g2.wp_loit_speed value if we are a boat and within the wp-radius.

Detecting which direction to turn in is challenging though because there is both the wind and the current. I suspect the current will be a bigger factor than the wind. I initially thought maybe we could use the EKF’s wind estimation (which works in plane and will be added to Copter in the next couple of months) to estimate current but @priseborough says that’s unlikely to work and instead says, “if the boat was travelling forward with a reasonable throttle we could use the sideslip fusion that plane uses”. I’m not familiar enough with Plane to know how to do that yet but I guess it involves learning the current speed and direction while navigating in straight-ish lines to a waypoint.

Re detecting the current, this is a half-baked idea but I wonder if we could add current-learning while the boat has it’s motors off.

If we recorded the vehicle’s position and velocity at the moment the motors were switched off and then again when the boat drifted out of the wp-radius and we switch the motors on again, along with the time difference, we might be able to calculate the current. I suspect it’s a slightly tricky calculation but it wouldn’t necessarily have to be perfect if we used some simple learning involving updating an estimate somewhat slowly over time.

Once we have the current estimate I think we will need a new mode which tries to hold position near a waypoint without actually trying to reach.

Hi rmackay9
thanks for the interesting reply. It may be really hard to distinguish between current and wind. We will add a wind sensor anyway and therefore it would be nice to fuse it with EKF in some way.
To have a better idea we could do some testing this Saturday in a river to gain some log data and hopefully it will also have some wind to see the two forces act on the boat (in the river with wind & on the lake with wind).

Hi
This is a interesting topic, I have experimented with loiter with the older version (3.1) of rover with a smaller skid steer boat. I found with a constant current (approx 0.2 m/s) and a WP distance of around 1m the rover could quite adequately hold a position, when the wind gusting in different directions (up stream and cross winds), the boat did circle and hunt for WP.

This is to be expected as it is a complicated use case and only having 2 motors, it is hard to resolve. Adding extra sensors would be interesting to see if it could be resolved better.

As a comparison I downloaded Ardusub and used a vectored (4 thrusters at 45 degrees) configuration to gain more control over the movements of the boat.

Ardusub Isn’t the best platform to use for a boat, doesn’t support RCIN and waypoints don’t work well, but it allowed me to rapidly experiment with this setup. There is a stabilized mode (heading hold) and a position hold mode (loiter) that do work.

The position hold mode holds the heading and position at the same time which is handy if you have sensors taking measurement in the water that require a particular orientation for best results.

I can say with limited testing that it can hold the position very well in current and wind as the boat can move in any direction to maintain position, very much like a quad copter.

My opinion is that if your requirement is to have a very accurate loiter, adding extra motors might be an easier solution than adding extra sensors. I am hoping in the future that rover could add support for different and custom frame configurations for boats (like Ardusub does for ROV) to maximize the maneuverability option for boats. The code has been written not sure how hard it would be to role over into rover.

Cheers

1 Like

I brought this item up on the weekly dev call this morning and someone also brought up the idea of adding thrusters to help with active loitering. Generalising out the control is definitely not trivial. We have skid-steering and regular-steering … at some point I’d like to add support for the horizontal movement that some robots can do (like this one) but I haven’t thought through how to do that yet. I suspect it would require a completely different control mechanism, much more like what we use Copter/Sub (copters and subs use the same controllers).

@Matthias,

I hope you don’t mind, I plan on adding a picture of your boat and a high level image of the path your boat took (from the dataflash log you sent me a couple of days ago) on the “Rover update” page of our monthly Partners call. As part of the monthly update I just like to mention some of the interesting things I’ve seen over the past month. Sound OK?

Ok with me :slight_smile:
How hard would it be to already have WP_LOIT_SPEED for Saturdays trial? (if you point us again in the right direction we could compile it for saturday)

Hi Matthias,

I’m trying to get drone based follow (i.e. no ground station required) working before our event in Canberra Australia next week so I don’t think I can add WP_LOIT_SPEED before then but I’ve put some advice above (look for “calc_throttle”) which outlines how it can be done…

Hi guys,

Another option I thought of to determine current and align the boat properly was to engage a little bit of throttle (so in theory the gps heading estimate and compass heading should line up perfectly) and then compare the compass heading and gps heading estimate.
Using the angle between those two should give us an amount and direction of steering to apply, using only pretty basic calculations.

I never tried to implement it tough, and didn’t go any further in my research… But I’m definitely interrested in that function for our boats!

1 Like

Nicolas,

That’s a very interesting idea. so comparing the direction of movement with the vehicle’s heading and rotating the boat so it is always heading in the opposite direction from the way it is moving… might work!

Yes, something like that. It should be enough to keep the boat aligned with current as long as the current flows in a consistent way imo

Hi, I am working on a similar application with a position keeping boat with skid steering. I would agree with the ones above advocating that the Loiter function should counteract the “drift” which is a combination of all environmental forces (current, wind and waves). To add a wind sensor will in my view be a step in the wrong direction as it would not detect all forces. I also hope to avoid adding more thrusters to get this to work in all conditions.

If we can have a function that will keep the boat always heading towards the WP (+/- X degrees) and add a WP_LOT_SPEED throttle when the boat drifts outside the WP_RADIUS, I think it would be great!

My main sponsor, eLab (elab.co.jp) has now asked for this as well so I’ve added it to my to-do list for Rover-3.3.

Of course, if other developers out there want to give me a hand, I can give more detailed advice on how to do this.

Hi rmackay9; I am eager to help out with testing, ideas and maybe coding as soon as I am familiar with the code. Let me know what the best way for
At the moment I am looking into the sensor data of our tests if I can extract the correct wind direction.
One finding of the last test with loiter was that something like: WP_LOIT_SPEED=WP_SPEED*(Distance_to_destination/WP_RADIUS)^1.5 should be constantly adjusted while the boat is inside the WP_RADIUS. Out of the sensor-data a combined outer force (wind+current) could be calculated and therefore the throttle could be reversed only if the boat is drifting windward of the WP.

I’m interested in testing too, I have a skid steer ASV.