Fly by Wire B on APM

I have a problem with the current implementation of FBW B.
The pitch is controlled by airspeed_error -> calc_pitch function
The throttle is controlled by airspeed_error and altitude_error -> calc_throttle function

If I am on a leveled flight and I want to go up ->  altitude_error will be negative (I am below where I want to be)
calc_throttle will increase thrust to bring altitude_error to zero
calc_throttle will increase thrust to keep airspeed_error to the minimum as I am going up and loosing speed
Calc_pitch will try to pitch down the elevator to keep airspeed_error to the minimum as I am going up and loosing speed .

The pitch behavior seems counter-intuitive but it works ok as it will first go up before loosing speed and only limit the rate of ascent to keep speed at the requested level.


If I am on a leveled flight and I want to go down -> altitude_error will be positive (I am above where I want to be)
calc_throttle will decrease thrust to bring altitude_error to zero
calc_throttle will decrease thrust to bring airspeed_error to zero as I am going down and gaining speed
Calc_pitch will try to pitch up the elevator to bring airspeed_error to zero as I am going down and gaining speed

That part above looks ok to me, we play with thrust to go up or down and move the elevator to keep speed constant.

now the hard part


If I am on a leveled flight and I decrease throttle which means going slower ->  altitude_error does not change but airspeed_error will go positive:  I am above the speed that I want to have
calc_throttle will decrease thrust to decrease airspeed and bring airspeed_error to 0
calc_throttle will do nothing about altitude_error as altitude_error is 0 (altitude_error is only commanded by radio pitch request)
Calc_pitch will try to pitch up the elevator to bring airspeed_error to zero.

If I am on a leveled flight and I increase throttle which means going faster ->  altitude_error does not change but airspeed_error will go negative :  I am below the speed that I want to have
calc_throttle will increase thrust to increase airspeed and bring airspeed_error to 0
calc_throttle will do nothing about altitude_error as altitude_error is 0 (altitude_error is only commanded by radio pitch request)
Calc_pitch will try to pitch down the elevator to bring airspeed_error to zero.

That's where I am confused. It basically means that if I increase the throttle command the plane will pitch down and increase throttle. It will therefore not respect the altitude request (ie pitch at 0 which means leveled) and it is not intuitive and even dangerous as putting max throttle will make the plane point towards mother earth at full throttle until the requested speed is reached.

Benjamin Pelletier fixed a lot of issues that were in FBW_B lately (issues 184/185) but I am still wondering about the proper logic of it.

Shall we
- remove throttle control completely and rely only on AIRSPEED_CRUISE and not accept any input from throttle commands
- give absolute priority to level flight when increasing / decreasing the throttle even if we do not reach desired speed
Or am I missing something like PID modification or other parameters ?
Thx

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

Join diydrones

Email me when people reply –

Replies

  • Developer
    Just to let you know the original intention of FBW B. It's not arbitrary, it's intended to simulate the Autopilot for testing.

    The throttle commands airspeed_error to test the behavior of the pitch and throttle. AIRSPEED_FBW_MIN, AIRSPEED_FBW_MAX give you control over this.

    Pitch and roll control from the radio gives the plane the exact input as would get from the Autopilot nav commands. If your plane doesn't fly correctly based on your roll/pitch input, it won't fly correctly in Autopilot.

    FBW_B is not intended to be a standard flying mode. Use FBW_A for that. We are open to rename these modes. I'm not a fan of the names either.
  • Except for a minor quibble, I think you've described the plane's intended behavior pretty well given a certain set of gains. The quibble is that throttle is adjusted on the sum of altitude_error and airspeed_error, so if you were simultaneously too high and too slow in the right amounts, the throttle wouldn't adjust at all (instead, the plane would bleed off the extra altitude by diving to speed up).

    You're right that increasing the desired airspeed suddenly close to the ground is probably going to cause the plane to nose into the ground. However, this is actually the correct behavior to a certain extent. A stall is very bad and a good pilot will lose a lot more altitude stalling the plane than he will by performing a quick dive to regain airspeed. The scenario that this tradeoff would have to be made in is an approach to landing when the pilot isn't watching his airspeed. The stall horn goes off (meaning airspeed is too low) and the pilot has to react. The correct reaction is to dive immediately to regain airspeed.

    So, what should we do when we want to throttle up as quickly as possible near the ground without diving the plane into the ground? I don't think the APM currently has a feature that's specifically design to address this problem, but there are at least a few ways around it. First, you could lower the pitch-for-airspeed gains. So, when the requested airspeed suddenly jumps, the plane doesn't pitch down as much to recover airspeed. Second, you could increase the throttle-for-energy gains. So, the plane will build up the extra energy more quickly. Of course, the former will put the APM at greater risk of not avoiding a stall, and the latter will make the throttle more jumpy. Second, you could just use FBW_A. The throttle will no longer directly set the target airspeed, but it will correlate to particular airspeeds. And, the plane won't dive when you throttle up.

    Two other ways I was thinking about involve code changes. The first could be to set a minimum_pitch via a new NOW command. The second could be to set a minimum_altitude via a new NOW command that would take over pitch control when it was broken. Neither one is particularly hard, but neither is trivial either.

    Generally speaking, I think the reason this hasn't been addressed yet is because autopilots' primary functions don't usually involve flying very close to the ground.
  • Developer
    FBW-B is not intended for you to have any direct control of throttle or ability to change the airspeed by changing throttle. The throttle stick instead will produce a climb or descent rate. Airspeed always attempts to hold the nominal value. Your choice of PID gain values will have a large affect on the way that this behavior all plays out. You should tune so that the airspeed hold works well first, and then work with the throttle gains.

    FBW-B is an "arbitrary" mode, in that there are lots of ways you can set up a FBW system. We solicited input, which varied widely, on what people would like in terms of effect of control inputs, and this is the implementation chosen. As far as I can see the only people who use FBW-B much are people doing FPV. I myself much prefer FBW-A
This reply was deleted.

Activity