Add wake for formation flight

Hello !

I am a newbie in SITL (this is my first post).
I would like to use this simulator to control a fixed-wing drone that would be flying in the wake of another drone, so that the drone behind would save energy by using that wake to reduce the throttle.

So basically, I have the equations of the wake of a certain plane, and I would like to be able to “add” them in the SITL simulator so that the plane I am simulating would be flying as if he was in the wake.

I’ve looked already in the C++ files of ArduPlane, but it will take me a loooong time to find out where I could add these wake equations. Is there anyone familiar enough with the code to indicate where I should be looking for that?

Thanks a lot !

The place to put the physics in the code is probably in here:
https://github.com/ardupilot/ardupilot/blob/master/libraries/SITL/SIM_Plane.cpp#L250

I suggest that you could possibly simulate a point moving with constant
radial velocity relatively easily. Getting a whole 'nother plane into
SITL is going to be tough if you want lock-step simulation to be
available, and for one vehicle to know where the other is. Previous
multi-vehicle simulations (like my avoidance stuff (
https://github.com/dronekit/dronekit-python/tree/source-system-filtering/examples/avoidance
)) haven’t tried to wedge two aircraft into the one SITL simulation. Even
if you were to forego the lock-step advantages of SITL and reuse that
avoidance stuff, you’d have to plumb the other vehicle’s position down
into the SITL code, which would be a chunk of work. Borrowing concepts
from Copter’s “Follow Me” mode - i.e. having Plane’s GCS_MAVLink stash
away the location of the other vehicle would probably be a good start on
that work, but getting that data into the simulation is probably going to
be pretty gross.

Hi!
The moving point simulation is exactly what I am planning to do.

Thanks for the link, that seems indeed to be where I can play with the physics of ArduPlane.

Just one more question: I’m familiar with programming in C++, but I have no idea how to recompile the whole project after I modified that file. Do you know how I’m supposed to do that ?

Thanks a lot

Re-run the SITL simulation; it will recompile what’s required. Check out
our Wiki on SITL - it’s not completely awful! :slight_smile: