- a prerecorded GPS target location (and possible intermediate waypoints) saved to file
- the takeoff GPS location
- an arbitrary takeoff flight direction akin to an aeroplane taking off down a runway i.e. autopilot sends motion process velocity vector of (0.3,0) = 0.3m/s forwards from Hermione’s point of view.
- autopilot receives updates from GPS when there is a change from the previous one (i.e. GPS resolution is roughly a meter, it’s rate is typically 1Hz, and the flight speed is fixed at about 0.3m/s so each GPS update won’t necessarily be a change from the known location)
With the above, when autopilot receives a changed GPS location update, a GPS direction of flight (θ1) is calculated based on the difference between the previous (L1) and current (L2) GPS location. Another direction (θ2) is determined from the current (L2) to the target GPS locations. Knowing these two directions – the direction it is and should be going – autopilot sends motion processing a yawed version of the current (initially (0.3,0)) velocity vector. This repeats until the current GPS location matches the target GPS location, at which point, a standard landing is sent by the autopilot to the motion processor – or in future, another waypoint is read from file and the above repeated again.
The above is relatively simple to implement, however there’s a lot of finicky bits to shuffle around so the code works:
- Auto-pilot needs to be told it’s using GPS not file based routing
- GPS waypoints are collected by the main process
- flight GPS locations are processed by the autopilot
- GPS is started fresh each flight / waypoint collection as the GPS process feeds into different processes per-flight or waypoint
- Autopilot takeoff hovers while waiting to acquire enough satellites at the starting position, only then triggering the movement along the “runway”.
There’s probably others I haven’t thought of yet.
The result will be a bit of a zig-zaggy flight towards the target, primarily because the GPS target is likely to be less than 10m away, and GPS resolutions is down at about 1m. If I get this to work, this is the last but one step of full-autonomous-flight completed! However, the last is perhaps the hardest (perhaps impossible) to achieve: the route through a maze.