Return to Home instead of GPS hold

If you only allow the GPS coords to be assigned to long, lat variables in GPS hold mode only one time when the switch is flipped, it could be used as a Return To Home command, couldn't it?

 

I think this is the associated code:

----

if (gps.fix){   // We need a GPS Fix to capture the actual position...          

target_latitude = gps.latitude;          

target_longitude = gps.longitude;        

target_position=1;        }

-----

 

Could be something like (THIS IS PSEUDOCODE, DO NOT COMPILE THIS!)

 

if gps.fix && return_to_home ==0 {

target_latitude = gps.latitude;          

target_longitude = gps.longitude;   

target_position=1;

return_to_home=1; //this section of code would only run once

}

-----

 

The ideal situation would be to read the GPS once the throttle is activated or as soon as there is a GPS lock, but I haven't tried looking for that function in the code yet.

 

 

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Please,could I ask here what is the Arduplito mega behaviour when a Loss of GPS failure happens during non manual mode?

    Will it Loiter at the current coordinate without GPS data?

  • Good idea!

    Or even better - why not store the coordinates at the first liftoff? This way, you wouldn't need to remember to flip the gps switch to set the RTH position.
  • Of course, this could all be moot as soon as the new code is released! but it's a good mental exercise
This reply was deleted.

Activity