ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.46k stars 17.11k forks source link

Plane: take advantage of thermals in AUTO with normal aircraft #6773

Closed robustini closed 3 years ago

robustini commented 7 years ago

Issue details

The "soaring" mode is very useful if you use Ardupilot with a glider, but unfortunately it lacks an important feature for those who want to make automatic missions using thermal and dynamic with a normal plane. During a endurance tests in "AUTO" flight mode with my MiniTalon i often found thermal, but unfortunately the autopilot tried to keep the plane at the set height of the mission, thus losing efficiency and endurance. The 5 waypoints were all placed at 70 meters in loop mission, and often the plane proceeded without propelling for the presence of thermal, but is forced to stay at this height. In that condition the autopilot forced the plane to stay at 70 meters, thus losing the chance to exploit such heat to heighten. I don't want you to enter "Loiter" if he finds a thermal, I wish he could go up high by proceeding for his mission, or during cruise. What I would like to implement is a rather simple concept for the plane with propulsion, functional in these cases, for example by setting existing paramaters without adding another. In detail, an example:

SOAR_ENABLE,2 # 0 disabled, 1 for glider, 2 for plane with propulsion SOAR_ALT_MIN,70 # ignored in this concept SOAR_ALT_MAX,350 # must obviously be higher than the height set in the waypoints

During an automatic mission with fixed waypoint at 80 meters if the plane gets thermal condition is not bound to stay at 80 meters but can climb up to 350, and once reached that height the TECS will prevent it from going up further. If the plane tends to fall below 80 meters, the autopilot will obviously give the engine so as to keep it above that height, as it already does. With the "SOAR" parameters this thing can't be done at this time. The same concept could apply to "CRUISE" and other automatic flight mode.

Version

Plane V3.8.0

Platform

[ ] All [ ] AntennaTracker [ ] Copter [ x ] Plane [ ] Rover

Airframe type

MiniTalon and other...

Hardware type

Pixhawk

Logs

samuelctabor commented 7 years ago

Hi Marco,

Good idea. I think that with SOAR_ENABLE=0 and TECS_SPDWEIGHT=2 the TECS will just reduce throttle (possibly to zero, I'm not sure) if it is lifted above the waypoint altitude by a thermal. So perhaps the required functionality is to set TECS_SPDWEIGHT=1 while this happens. Would that achieve the effect you're looking for?

magicrub commented 7 years ago

@samuelctabor what he's saying is if a given way point is x, don't limit yourself to x. Allow it to go all the way up to y during normal operation. Basically, lower bound is enfoced but upper altitude bound is encouraged to exceed where possible

robustini commented 7 years ago

Thanks Tom for a better explaination. And of course there must be a point z where the plane beyond can not go up (max altitude). @samuelctabor, with what you tell me to do I don't get the desired result. The autopilot force the plane to stand at that height during AUTO, Cruise, FBW. Even if it finds thermal, in that case Ardupilot turns off the propulsion, but if the thermal tends to push it high, the autopilot keeps it tied to that predetermined height.

robustini commented 7 years ago

This is the TLOG of my flight with my MiniTalon, over three hours in full automatic mission. If you analyze it you can see that there was sometimes a wind holding the plane it in the air, it's awesome, the wind at the same speed of the Cruise speed, in some places the plane reverses instead of advancing (around 14% of this flight). In some conditions the motor is switched off because it finds thermal, but the autopilot binds it to the set height, thus losing efficiency...

https://drive.google.com/file/d/0B3HEcrNCOga9SVBVd1NlTllCUlk/view?usp=sharing

samuelctabor commented 7 years ago

Hey Marco, having a look at this now: are you sure that's the right log? I can't see any events where the motor was switched off in AUTO mode ( it did go down to around 10% at one point).

Cheers, S

robustini commented 7 years ago

Hey Samuel, i'm not sure about that log, but I'm sure the code behaves that way, force the plane to stay at the "waypoint or CRUISE height", even if there are thermal.

magicrub commented 7 years ago

It feels like we need to add something like this to here:

else if (_soaring_controller.is_active() == 2) {
    // if soaring, focus on airspeed and allow sloppy height management
    SKE_weighting = 2.0f;
}

and this needs something like:

if (_soaring_controller.is_active() == 2 &&
        _soaring_controller.isInThermal() &&
        _flags.underspeed == false &&
        alt < _soaring_controller.alt_max &&
        alt < mission.alt))
{
    // if soaring and we're in a thermal, ride it upwards and don't pitch down
    _PITCHminf = 0;
} else if (_pitch_min >= 0) {
...
robustini commented 7 years ago

Yes Tom, something like this! That's exactly what I asked, modifying the code in that way...

magicrub commented 7 years ago

@samuelctabor What is a good way to simulate thermals for SITL testing?

magicrub commented 7 years ago

ahh, I see. You were using X-Plane. I'll see about adding some magical ones to JSBsim for easier crude testing

samuelctabor commented 6 years ago

I've had a go at implementing this - https://github.com/samuelctabor/ardupilot/tree/soaringForPoweredAC It needs some more testing but you're welcome to give it a go. It simply sets the SKE weighting to 2.0 if SOAR_ENABLE==2 and alt< SOAR_ALT_MAX. I haven't modified the pitch limits. My test aircraft is not behaving well in simulation so I need to do some debugging on that. For testing I usually use JSBSim with some 'magic' thermals - see branchs thermalsJSB or soaringForPoweredAC-dev.

Cheers, S