jdl

  • ***
  • 246
Guidance Alarms in RTB (FixedWing)
« on: June 05, 2017, 03:29:21 pm »
I have a small wing (WingWing Z84) with Revo board, GPS and extranal I2C Mag. Sensors work fine, no MAG alarms.

Here are the settings I have:

HWSettings / OptionalModules / Airspeed is enabled.

AirspeedSettings / AirspeedSensorType is set to GroundSpeedBasedWindEstimation.

FixedWingPathFollowerSettings / UseAirspeedSensor is set to True.

HorizontalVelMax = 15m/s
HorizontalVelMin = 10m/s.

SafetyMargins / LowSpeed = 0.7
SafetyMargins / HighSpeed = 1.2

VerticalToPitchCrossFeed / Kp = 9
VerticalToPitchCrossFeed / Max = 12

PitchLimit / Min = -10 deg
PitchLimit / Neutral = 10 deg
PitchLimit / Max = 30 deg

TrustLimit / Min = 0.15
TrustLimit / Neutral = 0.5
TrustLimit / Max = 0.7

SystemSettins / AirspeedMax = 15
SystemSettins / AirspeedMin = 8.5

FlightModeSettings / ReturnToBaseAltitudeOffset = 0 m
FlightModeSettings / ReturnToBaseVelocity = 11 m/s


So...
PositionHold works flawlessly. Absolutely.

The problem is in RTB mode. When engaged, for the first 10 seconds everything goes as expected. Then the PATH tab in SystemHealth goes orange, Guidance alarms are reported, the throttle is raised gradually all the way to TrustLimit / Max and the plane rockets to the Home Position. AirspeedMax and HorizontalVelMax are not conformed with.

After looking at the PathFollower code and examining the telemetry records I found that the strange behaviour is caused by wrong estimation of the CalibratedAirspeed. As seen on the snapshot, during straight and horizontal flight (RTB), the real (GPS) speed rises but the CalibratedAirspeed is reported lower and lower, so the Autopilot tries to give more and more throttle and even pitch more and more down (as ErrorInt.Speed accumulates) in its effort to gain speed. It thinks that the plane is goint to stall (Airspeed reaches 5m/s when GPS speed > 21m/s!) so HorizontalVelMax * SafetyMargins.HighSpeed are not processed at all.

Any ideas what may be wrong with the settings or the wing setup?

The only cheat I used, based on the advice from the forum, is that I set the

AttitudeSettings / BoardRotation / Pitch = -4
AuxMagSettings / BoardsRotation / Pitch = -4

to help the Autopilot easier maintain altitude under thrust. It works very nice for PositionHold and RTB  engagement.

I upload the current UAV file.

I know that GroundSpeedBasedWindEstimation is not equivallent to a real Airspeed sensor but it still should be able to work in almost no wind conditions. So I assume I did something wrong setting the plane. But I'm now out of ideas...

I also uploaded a short video of the "Rush-to-Base" situation :)

https://youtu.be/7rkaYBJnF_Q

If it would be helpful, I can also supply the full telemetry record (OPL) file.

Thanks in advance for your comments and suggestions.



« Last Edit: June 05, 2017, 03:55:05 pm by jdl »

Re: Guidance Alarms in RTB (FixedWing)
« Reply #1 on: June 05, 2017, 05:58:48 pm »
I have been doing the exact same thing for the last week.

I started a couple weeks ago by tuning rate and attitude PIDs (yaw is unstabilized manual) so that these modes worked well.

Then when using GPS modes, I adjusted FWPF min, neutral, and max thrust (to something like 0.2, 0.4, 0.6) and set horizontal velocity min=max=12 to get rid of crazy speeds it had.  Speed still varied a lot, but at least it was usable.

A week ago I tried some simple 2 waypoint flight plan and it would almost never get to point #2.  Reviewing the log there was a guidance alarm seeming to say that the pathfollower was getting CPU less frequently than it should (100ms).  Reviewing further there were some safety warnings, two kinds of overspeeds and one kind of underspeed.  A review of the code at the field showed that if I set the waypoint error location to a negative number that the errors/warnings would be ignored.  I did that and got a simple 4 waypoint flight plan to run successfully for as long as I let it run (maybe 10 laps).

I haven't done further investigation.  This is a stock Bixler 2.  FWPF needs some TLC.  :)

Rather than those 4 degree pitch changes, there are FWPF settings for exactly that.  I adjusted them to get a good angle of attack.

Re: Guidance Alarms in RTB (FixedWing)
« Reply #2 on: June 05, 2017, 06:18:43 pm »
I had added looking into the airspeed estimation to my list of things to play with.  :)  It looks to me like simple GPS ground speed would be better in light wind than what I currently have.  There are some algorithms (delta G / delta AOA -> airspeed=X) for airspeed and considering developing the concept of updating a constant windspeed vector (with limits, and only updated in certain "reasonable" flight conditions) to subtract from the GPS velocity vector.

I haven't tried disabling the (GPS groundspeed based) airspeed sensor in FWPF, but that was some of the next things to play with.  It supposedly just maintains a fixed AOA if you disable FWPF airspeed.

I ordered an airspeed sensor to help testing and coding.
http://xt-xinte.com/F19512.html
Edit: looks like they changed their web site.  This seems to be the one we bought and used:
https://www.xt-xinte.com/Ardupilot-Arduplane-Airspeed-Meter-Sensor-Kit-With-Pilot-Tube-for-APM2-5-2-6-2-8-Flight-Controller-p138778.html

Come to think of it, I do recall seeing the tooltips say something like the max speed was to be used for long distances and the min speed for loitering.
« Last Edit: December 01, 2019, 10:24:30 pm by TheOtherCliff »

jdl

  • ***
  • 246
Re: Guidance Alarms in RTB (FixedWing)
« Reply #3 on: June 06, 2017, 03:27:40 pm »
Thanks! You gave me some interesting ideas.

As for 4 degree pitch changes in BoardRotation, it's better to play with FWPF / PitchLimit / Neutral, right?

I've already tried to disable FWPF airspeed module at all and I managed to set an usable in moderate winds PH & RTB, playing with Thrust Limits only. But no chance for energy efficient flight.

I'm quite busy now to read thoroughly the code, but when I examined it some time ago I was under impression that if I leave

HWSettings / OptionalModules / Airspeed = enabled
FixedWingPathFollowerSettings / UseAirspeedSensor = true


and simply set

AirspeedSettings / AirspeedSensorType = none

the airspeed module will function replacing airspeed with groundspeedprojection ? Or I'm wrong and hasAirspeed variable will be constantly false due to lack of refreshing data from sensor? I may test this tomorrow if I have a chance to fly.

Thanks for sharing the link for this airspeed sensor

http://xt-xinte.com/F19512.html

The price is the best I've seen so far.

I was almost ready to order this one:

https://www.rc-log.co.uk/airspeed-microsensor-v3.html

May I ask for your advice? Does the pre-calibrated feature and I2C communication justify more than twice higher price? I've read that the MPXV7002 sensors are not temperature compensated. On the contrary, the Eagletree Airspeed Microsensor V3 is. So I'm uncertain which one to choose?

Re: Guidance Alarms in RTB (FixedWing)
« Reply #4 on: June 06, 2017, 05:52:26 pm »
As for 4 degree pitch changes in BoardRotation, it's better to play with FWPF / PitchLimit / Neutral, right?
That's my understanding.  If you set RotateVirtual, it affects normal Attitude flight too.

I was under impression that if I leave

HWSettings / OptionalModules / Airspeed = enabled
FixedWingPathFollowerSettings / UseAirspeedSensor = true


and simply set

AirspeedSettings / AirspeedSensorType = none

the airspeed module will function replacing airspeed with groundspeedprojection ? Or I'm wrong and hasAirspeed variable will be constantly false due to lack of refreshing data from sensor? I may test this tomorrow if I have a chance to fly.
I haven't read the code that closely, but if so, that would be a good thing for me to test too.  :)

Does the pre-calibrated feature and I2C communication justify more than twice higher price? I've read that the MPXV7002 sensors are not temperature compensated. On the contrary, the Eagletree Airspeed Microsensor V3 is. So I'm uncertain which one to choose?
I honestly don't know.  I just bought the cheapest one for testing.  I am assuming I/we can get some estimation algorithm working well enough to just use GPS in most cases.

jdl

  • ***
  • 246
Re: Guidance Alarms in RTB (FixedWing)
« Reply #5 on: June 12, 2017, 09:28:08 am »
I can report some success, though not 100%.

It seems that increasing the

Airspeed Settings | IMUBasedEstimationLowPassPeriod1 to 0.75s and
Airspeed Settings | IMUBasedEstimationLowPassPeriod2 to 20s

gives quite stable behaviour of GroundSpeedBasedWindEstimation module on the small and twitchy/shaky Wing Z84.

In calm weather (winds below 10km/h) I had 100% successful RTBs from over a kilometer (5 or 6 test returns).

If stronger winds (15-20km/h) three RTBs were perfect and one attempt failed (motor gradually went to full power (Max Trust Limit)). It worths testing if further increasing the LowPassPeriod constants will improve the module behaviour.

Re: Guidance Alarms in RTB (FixedWing)
« Reply #6 on: June 12, 2017, 11:56:37 am »
In the past few days I have tested fixed wing RTB about 10 times; all from close by (100m to 500m) so I have not tested speed / altitude / course over anything like a long distance.  All were successful.

Settings I changed:
        <object id="0xDA4294AA" name="FixedWingPathFollowerSettings">
            <field name="HorizontalVelMax" values="12"/>
            <field name="HorizontalVelMin" values="12"/>
            <field name="VerticalVelMax" values="2"/>
            <field name="HorizontalPosP" values="0.400000006"/>
            <field name="VerticalPosP" values="0.5"/>
            <field name="CoursePI" values="0.400000006,0,0"/>
            <field name="PitchLimit" values="-4,7,20"/>
            <field name="ThrustLimit" values="0.100000001,0.550000012,0.649999976"/>
        </object>

I set horizontal velocity min=max=12 to try to get the speed more consistent.  Speed still varies a lot on waypoint flight and Base loiter.
I reduced vertical velocity, negative pitch limit, and max thrust limit to try to avoid scary dives.  Nothing scary any more.
I increased horizontal P, etc. to make turns and loiter tighter.  It worked.

I believe that the motor stops (lower than .1) during loiter at Base.  When I was flying waypoint flights there were both kinds of over speed warnings (fwpf max and system wide max) and under speed warnings.  I set the error destination of each waypoint to -1 to disable the error destination and it successfully flew many laps of a small simple 4 waypoint plan.  Before that it was constantly erroring and going to WP#1.

It would be nice to have a step by step setup and tuning guide, fixing alarms, etc. for fixed wing.
build balance align
fly in manual mode and adjust trims mechanically so that transmitter trims are centered
fly in rate mode (yaw manual) and adjust Stabilization page PIDs for maximum response without oscillation
fly in attitude mode (yaw manual) and adjust for max response
(fixed wing needs to zero the integral when in manual mode so that a switch to stabilized doesn't go crazy for a few seconds, yes you can zero the throttle, switch to stabilized, increase throttle to work around this)
enable GPS airspeed sensor in two places
determine airspeed and set fwpf speeds and throttles
adjust fwpf horizontal PIDs etc to tighten up loiter
crossfeeds and other stuff ???

Re: Guidance Alarms in RTB (FixedWing)
« Reply #7 on: June 19, 2017, 03:48:22 pm »
@jdl:
May i ask for your newest uav-export file of the Z-84? What's your setup?

I'm building my second Wing Wing Z-84. My first one was completely manual, only RX with a delta-mixer.  This one will carry a revo-mini FC, gps and oplink and should go for waypoints and RTH.

Do I need an airspeed sensor? I would like to keep the wing under 400g with 3S 1300mAh so i would like to cut every unnecessary weight.

Thanks in advance.

jdl

  • ***
  • 246
Re: Guidance Alarms in RTB (FixedWing)
« Reply #8 on: June 20, 2017, 02:23:45 pm »
@altermac:

I'll attach here the most recent working setup file. Be warned, it is experimental yet :)

My setup has Emax MT2204 motor, Gemfan 5550 propeller, Littlebee 20A ESC with small heatsink, PDB with SBEC and buzzer (9 gram), Revo FC, uBolx 7M GPS (6 gram), external 5883L Mag module (cannot do without it, internal mag on the FC goes crazy all the times), Micro camera (2 gram), MinimOSD, 5.8G VTx, 2 x Emax 3352 digital servos and Mobius Mini HD camera. Fully laminated (50 grams).

AUW with 3S 1850mAh 35C battery is about 515 grams. With 3S 2200mAh - 550 grams. You can look in this thread for some photos of my setup:

https://forum.librepilot.org/index.php?topic=3381.0

I think the airspeed sensor is a must if you look for fully automated flight. Till now experiments with GroundSpeedBased wind estimation show some success but are not 100% reliable in more compex windy conditions. Otherwise, just for PH and for RTB initiation, it works flawlessly. But when travelling longer legs, sometimes the FC estimates the airspeed incorrectly and gradually goes to full power (limited by MaxTrust limit). This stresses the power system and battery and is not really safe.


Re: Guidance Alarms in RTB (FixedWing)
« Reply #9 on: June 21, 2017, 11:09:04 am »
Thanks for your UAV-file and your advice. I will report, when WingWing No.2 is up and running.