Trying to loiter indoors, LPE on pixhawk with px4flow

Hello guys. Currently, I am having a problem trying to loiter indoors without gps, and after reviewing a lot of discussion in github and px4.io, this is what I have done.

Hardware: DJI F450, pixhawk, px4flow (flashed with the default px4flow firmware and ultrasound facing forwards)

Firmware: build from px4fmu-v2_default after editing the cmake file. I tried to build the px4fmu-v2_LPE but it is not compiling, citing ‘specify a unique binary directory name’ as error.
therefore parts of Firmware/cmake/configs/nuttx_px4fmu-v2_default.cmake is then edited:

#
# Estimation modules
#
modules/attitude_estimator_q
#modules/position_estimator_inav
modules/local_position_estimator
#modules/ekf2

set(PARAM_DEFAULT_OVERRIDES “{\"SYS_MC_EST_GROUP\": 1}”)

The compilation of px4fmu-v2_default was a success, and all LPE params are now available. I then adjusted the params:

LPE_FUSION 242 (select no vision, no GPS. LPE_GPS_ON is not listed anymore.)
MPC_ALT_MODE 1

flight test:
POSHOLD mode
The altitude is not stable, and it keeps drifting away horizontally. LED went from blinking green to rapid blinking purple and its impossible to disarm at ground during the whole POSHOLD mode. I have to switch to STABILIZE mode to disarm.

If I set land detector to off in LPE_FUSION (226), POSHOLD will not allow arming.

Can you see where I might have messed up? Also, what is land detector, is it sonar? Thanks!

Logs
outdoors: FASTPANEL

2017_02_20_12_02_26: MANUAL KILL SWITCH ENGAGED
2017_02_20_12_02_28: [lpe] land init
2017_02_20_12_02_31: [lpe] baro init 47 m std 28 cm
2017_02_20_12_02_33: MANUAL KILL SWITCH OFF
2017_02_20_12_02_39: ARMED by RC
2017_02_20_12_02_39: [blackbox] /fs/microsd/log/2017-02-20
2017_02_20_12_02_39: [blackbox] recording: 12_02_39.px4log
2017_02_20_12_02_45: Takeoff detected
2017_02_20_12_02_46: [lpe] land timeout
2017_02_20_12_02_51: MANUAL KILL SWITCH ENGAGED
2017_02_20_12_02_54: no RC
2017_02_20_12_02_54: failsafe mode on
2017_02_20_12_03_02: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_03: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_03: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_04: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_04: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_04: failsafe mode off
2017_02_20_12_03_07: MANUAL KILL SWITCH OFF
2017_02_20_12_03_09: DISARMED by RC
2017_02_20_12_03_09: [lpe] land init
2017_02_20_12_03_10: [blackbox] stopped (7140 drops)
2017_02_20_12_03_10: Landing detected
2017_02_20_12_03_14: ARMED by RC
2017_02_20_12_03_14: [blackbox] /fs/microsd/log/2017-02-20
2017_02_20_12_03_14: [blackbox] recording: 12_03_14.px4log
2017_02_20_12_03_21: Takeoff detected
2017_02_20_12_03_22: [lpe] land timeout
2017_02_20_12_03_26: MANUAL KILL SWITCH ENGAGED
2017_02_20_12_03_26: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_29: no RC
2017_02_20_12_03_29: failsafe mode on
2017_02_20_12_03_36: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_36: failsafe mode off
2017_02_20_12_03_37: DISARMED by RC
2017_02_20_12_03_38: [lpe] land init
2017_02_20_12_03_38: [blackbox] stopped (1251 drops)
2017_02_20_12_03_39: Landing detected
2017_02_20_12_03_41: MANUAL KILL SWITCH OFF
2017_02_20_12_03_42: ARMED by RC
2017_02_20_12_03_42: [blackbox] /fs/microsd/log/2017-02-20
2017_02_20_12_03_43: [blackbox] recording: 12_03_42.px4log
2017_02_20_12_03_48: Takeoff detected
2017_02_20_12_03_49: [lpe] land timeout
2017_02_20_12_03_51: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_51: MANUAL KILL SWITCH ENGAGED
2017_02_20_12_03_52: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_12_03_55: DISARMED by RC
2017_02_20_12_03_55: [lpe] land init
2017_02_20_12_03_56: [blackbox] stopped (0 drops)
2017_02_20_12_03_56: LOW BATTERY, TAKEOFF DISCOURAGED
2017_02_20_12_03_57: CRITICAL BATTERY, SHUT SYSTEM DOWN
2017_02_20_12_03_57: Landing detected
2017_02_20_12_04_13: MANUAL KILL SWITCH OFF
2017_02_20_12_04_15: CAUTION: Avionics power low: 4.87 Volt
2017_02_20_12_04_15: ARMED by RC
2017_02_20_12_04_15: [blackbox] /fs/microsd/log/2017-02-20
2017_02_20_12_04_15: [blackbox] recording: 12_04_15.px4log
2017_02_20_12_04_17: DISARMED by RC
2017_02_20_12_04_18: [blackbox] stopped (0 drops)

indoors: FASTPANEL

2017_02_20_16_55_02: MANUAL KILL SWITCH ENGAGED
2017_02_20_16_55_04: [lpe] land init
2017_02_20_16_55_06: MANUAL KILL SWITCH OFF
2017_02_20_16_55_07: [lpe] baro init 27 m std 29 cm
2017_02_20_16_55_25: ARMED by RC
2017_02_20_16_55_26: [blackbox] /fs/microsd/log/2017-02-20
2017_02_20_16_55_26: [blackbox] recording: 16_55_25.px4log
2017_02_20_16_55_32: Takeoff detected
2017_02_20_16_55_33: LOW BATTERY, RETURN TO LAND ADVISED
2017_02_20_16_55_33: CRITICAL BATTERY, LANDING ADVISED!
2017_02_20_16_55_33: [lpe] land timeout
2017_02_20_16_55_39: MANUAL KILL SWITCH ENGAGED
2017_02_20_16_55_41: no RC
2017_02_20_16_55_41: failsafe mode on
2017_02_20_16_55_46: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_16_55_47: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_16_55_47: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_16_55_49: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_16_55_49: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_16_55_50: NOT DISARMING: Not in manual mode or landed yet.
2017_02_20_16_55_52: failsafe mode off
2017_02_20_16_55_54: DISARMED by RC
2017_02_20_16_55_54: [lpe] land init
2017_02_20_16_55_55: [blackbox] stopped (2483 drops)
2017_02_20_16_55_55: Landing detected
2017_02_20_16_56_05: MANUAL KILL SWITCH OFF
2017_02_20_16_56_06: ARMING DENIED: LOW BATTERY
2017_02_20_16_56_07: NOT ARMING: Preflight checks failed

Can you post a log? Either on http://logs.uaventure.com/ for *.px4 logs or http://logs.px4.io/ for *.ulg logs.

Hi Nicolas, I have edited my post with the flight logs. Thanks!

It doesn’t look like your flow module is running. There are no flow or distance messages in your logs. Can you post the message logs (in the root directory of the SD card) of those two flights?

Will there be a message if the flow is working? I don’t see it in the message logs everytime i run the UAV. I’ve posted the message logs, thanks!

You should see two messages:

“[lpe] flow init”

“[lpe] sonar init”

Neither of those are in your message logs.

You can also confirm that flow is working by checking in QGC > Analyze. If you don’t see any flow messages, it’s not running.

You are right, I just checked the cables and there seems to be some loose connection. I have then retried the flight test and gotten the following results. I suspect the sonar may be out of order, leading to a lot of crashes.

http://logs.uaventure.com/view/frjrVqh9dstyf42Qfp9hRh

2017_02_21_10_56_21: [lpe] land init
2017_02_21_10_56_23: [lpe] Sonar detected with ID 0
2017_02_21_10_56_25: [lpe] baro init 39 m std 25 cm
2017_02_21_10_56_28: [lpe] sonar fault, beta 122.63
2017_02_21_10_56_38: [lpe] sonar timeout
2017_02_21_10_56_43: MANUAL KILL SWITCH ENGAGED
2017_02_21_10_58_05: GPS fix regained
2017_02_21_10_59_34: [lpe] sonar fault, beta 12.57
2017_02_21_10_59_49: GPS fix lost
2017_02_21_10_59_49: [lpe] sonar timeout
2017_02_21_10_59_50: GPS fix regained
2017_02_21_10_59_51: GPS fix lost
2017_02_21_10_59_55: GPS fix regained
2017_02_21_10_59_56: GPS fix lost
2017_02_21_10_59_56: [lpe] sonar init std > min
2017_02_21_10_59_57: [lpe] sonar fault, beta 493.59
2017_02_21_11_00_01: GPS fix regained
2017_02_21_11_00_03: GPS fix lost
2017_02_21_11_00_06: GPS fix regained
2017_02_21_11_00_08: GPS fix lost
2017_02_21_11_00_08: GPS fix regained
2017_02_21_11_00_08: GPS fix lost
2017_02_21_11_00_12: [lpe] sonar timeout
2017_02_21_11_00_12: GPS fix regained
2017_02_21_11_00_13: MANUAL KILL SWITCH OFF
2017_02_21_11_00_15: GPS fix lost
2017_02_21_11_00_16: GPS fix regained
2017_02_21_11_00_16: GPS fix lost
2017_02_21_11_00_16: GPS fix regained
2017_02_21_11_00_19: [lpe] sonar fault, beta 66.85
2017_02_21_11_00_37: ARMED by RC
2017_02_21_11_00_37: [blackbox] /fs/microsd/log/2017-02-21
2017_02_21_11_00_38: [blackbox] recording: 11_00_37.px4log
2017_02_21_11_00_43: Takeoff detected
2017_02_21_11_00_43: [lpe] land timeout
2017_02_21_11_00_45: [lpe] flow init: quality 200 std 24
2017_02_21_11_00_45: GPS fix lost
2017_02_21_11_00_46: GPS fix regained
2017_02_21_11_00_48: MANUAL KILL SWITCH ENGAGED
2017_02_21_11_00_49: [lpe] flow timeout
2017_02_21_11_00_51: GPS fix lost
2017_02_21_11_00_51: GPS fix regained
2017_02_21_11_00_51: [lpe] sonar fault, beta 11.26
2017_02_21_11_00_53: no RC
2017_02_21_11_00_53: failsafe mode on
2017_02_21_11_00_55: [lpe] sonar fault, beta 12.50
2017_02_21_11_00_59: failsafe mode off
2017_02_21_11_01_00: [lpe] sonar timeout
2017_02_21_11_01_01: DISARMED by RC
2017_02_21_11_01_02: [lpe] land init
2017_02_21_11_01_02: [blackbox] stopped (1298 drops)
2017_02_21_11_01_03: Landing detected
2017_02_21_11_01_08: MANUAL KILL SWITCH OFF
2017_02_21_11_01_10: ARMED by RC
2017_02_21_11_01_11: [blackbox] /fs/microsd/log/2017-02-21
2017_02_21_11_01_11: [blackbox] recording: 11_01_10.px4log
2017_02_21_11_01_15: Takeoff detected
2017_02_21_11_01_16: [lpe] land timeout
2017_02_21_11_01_17: [lpe] sonar fault, beta 9.08
2017_02_21_11_01_19: [lpe] flow init: quality 186 std 19
2017_02_21_11_01_19: [lpe] sonar fault, beta 751.30
2017_02_21_11_01_23: LOW BATTERY, RETURN TO LAND ADVISED
2017_02_21_11_01_23: [lpe] sonar fault, beta 17.25
2017_02_21_11_01_24: NOT DISARMING: Not in manual mode or landed yet.
2017_02_21_11_01_24: MANUAL KILL SWITCH ENGAGED
2017_02_21_11_01_24: NOT DISARMING: Not in manual mode or landed yet.
2017_02_21_11_01_25: NOT DISARMING: Not in manual mode or landed yet.
2017_02_21_11_01_25: [lpe] flow timeout
2017_02_21_11_01_25: NOT DISARMING: Not in manual mode or landed yet.
2017_02_21_11_01_26: NOT DISARMING: Not in manual mode or landed yet.
2017_02_21_11_01_26: NOT DISARMING: Not in manual mode or landed yet.
2017_02_21_11_01_28: no RC
2017_02_21_11_01_28: failsafe mode on
2017_02_21_11_01_36: failsafe mode off
2017_02_21_11_01_38: DISARMED by RC
2017_02_21_11_01_38: [lpe] land init
2017_02_21_11_01_38: [lpe] sonar fault, beta 16.81
2017_02_21_11_01_39: [blackbox] stopped (3450 drops)
2017_02_21_11_01_39: Landing detected
2017_02_21_11_01_49: [lpe] sonar fault, beta 40.25
2017_02_21_11_01_50: GPS fix lost
2017_02_21_11_01_51: GPS fix regained
2017_02_21_11_01_51: GPS fix lost
2017_02_21_11_01_55: GPS fix regained
2017_02_21_11_01_56: GPS fix lost
2017_02_21_11_01_57: GPS fix regained
2017_02_21_11_02_00: GPS fix lost
2017_02_21_11_02_02: GPS fix regained
2017_02_21_11_02_04: [lpe] sonar timeout
2017_02_21_11_02_06: GPS fix lost
2017_02_21_11_02_09: GPS fix regained
2017_02_21_11_02_09: GPS fix lost

What do you think is the problem?

The range data is indeed quite noisy. I’m not surprised, sonar is not the most robust ranging method. I’d recommend a light based (lidar lite, teraranger) device.

You also have quite poor GPS quality. The position estimator never even uses it.

Yes, I have disabled gps by setting the LPE_FUSION to not take gps data. So you think the flow camera is ok, but the distance sensor is not? Have I done the correct compiling and settings in the firmware?

As far as I can see, yes.

I would recommend that you validate flow with hand held experiments. Hold the vehicle over a surface with good visual features. Then check in QGC > analyze what the distance measurements look like. If they look reasonable (the majority of the time they show the proper measurements, outliers are in the clear minority), check that you consistently have good flow quality. If that’s also the case look at the messages printed in QGC. You should see “flow init”, “sonar init”, “[lpe] xy init”, “[lpe] z init”, “[lpe] tz init”. As long as you see no “timeout” messages for any of those, things should be working. Check local position (in the analyze window), you should very clearly see that you are moving the vehicle in the data. Align the vehicle s.t. it faces north and move it forward/backward, you should observe positive/negative local_position.x changes, respectively. Same with moving it right/left for positive/negative local_position.y changes. If those correspondences are different, you have not correctly set the flow rotation and your vehicle would be unstable.

Just to confirm: You have written, that the ultrasonic sensor faces forwards? It should measure altitude instead.

Yes, I mean the orientation of the flow. The ultrasound faces downwards, in front of the camera. I have purchased lidar lite and I am now waiting for the lidar lite to arrive and I will give it another try.