HOLD when no rtk GPS fix, and back to AUTO when it recovers

@Andrew_Tridgell and others,

I need my rover to HOLD when there is no rtk GPS fix (i.e. when GPS fix type is lower than 5). Also, after such a hold, if the GPS fix recovers (i.e. changes back to 5 or 6) I’d like the rover to resume its mission, i.e. go back to AUTO mode. The basic logic I need is:

  1. If in AUTO, and GPS fix changes from (5 or 6) to (value <5), change mode to HOLD and DO_SET_SERVO #5 to 900
  2. If in HOLD because of the above rule (i.e. and not because of some other reason), and GPS fix changes from (value <5) to (5 or 6), then DO_SET_SERVO #5 to 2000 and change mode to AUTO

I looked and didn’t see any internal support for this within the Failsafe mechanisms inside Ardurover… Right? Given that, what if any difference do you see between implementing this as a LUA script and building logic on my companion computer?

Thank you

Hi Cristopher
It would be very a very interesting improvement this failsafe for rovers . It would ensure a secure path over time in restricted areas. there was an issue raised about this time ago https://github.com/ArduPilot/ardupilot/issues/8787 but for some reason was never implemented in rover upgrades.
Let me know if you succeed in a sript. I tried it in dronekit time ago but had some difficulties. I don’t remember very well but i think there was no way to ask for rtk status (5 or 6) in dronekit

Jose Luis, I implemented this failsafe in my companion computer… It’s running mavproxy and as such knows the GPS status. So I have solved this another way, and moved on. -Chris

Hello Christopher,
I have the same problem for my mower, can explain how you do that with your companion computer ?
Thanks

I implemented this via code on my companion computer. At a high level, the companion computer is running a python program we wrote that talks to the autopilot using MAV (using pymavlink). It monitors the GPS status and when the status falls below a certain level it sets the autopilot mode to HOLD while it waits for the GPS to recover, and when it recovers, it sets the autopilot mode to AUTO.

Barring that, I seem to recall a LUA script written by @Yuri_Rage that would be a good starting point for you to implement this on your autopilot directly. Perhaps look through the scrips here https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_Scripting/examples (or @Yuri_Rage perhaps you can point us to the script you developed for this??)

1 Like
1 Like

I think I have the default behavior set to use manual mode in the event of an undesired fix type, the intent being to drive out from under tree cover and auto-resume the mission when the fix type recovers.

@Yuri_Rage FYI at the recommendation of the ardusimple folks we are experimenting with upgrading our antennas to “budget survey” antennas to improve performance under heavy tree canopy . Initial experience (1 rover, 30 mins of operation) is encouraging. I’ll post when I have more robust comparison results.

I forget which antennas you were using before, but I use survey antennas on all of my large rovers. They do a great job.

Hello Christopher,
Thank you very much for your answer. It seem to be a good way, now i will learn how to use Lua.
A good job for my holidays. :slight_smile:

Hello Yuri,
Thank for this script, i will try it i will learn to use Lua script it is new for me. I see your tuto ’ ArduPilot Lua Scripting Basics’ it is a beginning. Now i’m not sure my version of ardurover is good for lua, i use the 3.5.1, maybe i have to update with ArduRover 4.2.3.

Yes, you must update to the latest stable ArduRover version.

Hello,
Yes i update it and it works i can run Lua script but only very short script (i have a pixhawk 2.4.8)
Thank you very much.

I’ve been thinking about the human factors on this - if the mower loses GPS stopping makes sense. Electric mowers can be silent while waiting - so springing back in to life may be surprising for anyone near.

We’ll implement a flavour of Yuri’s script (thanks Yuri - excellent) but start the ICE motor/blades then wait 10? seconds before moving again.,

We too implement a 10 second delay before automatically restarting.

We use a beacon (Agrieyes Amber Beacon Light… https://www.amazon.com/dp/B099HXWXCC?ref=ppx_pop_mob_ap_share) to indicate the mower is starting. It’s bright and impossible to miss even in broad daylight.