inav icon indicating copy to clipboard operation
inav copied to clipboard

iNav Config 1.6.3 - new preset 5" GPS - MAG going crazy

Open Antonio76m opened this issue 9 years ago • 29 comments

hi all, thanks in advance, I saw there is this new preset for 5" GPS, I have a 330 class with F3 Deluxe equipped with a UBlox GPS M8N if I set 5" Racer MAG is ok but if I select the preset 5" GPS, on the SEUP main page the Heading shows always 0 and if I move the quad it does not move in picture, is it safe to fly? does anybody knows how to fix? or any suggestion on setting to select the 5" Racer and optimize for GPS? attached 2 screens to try to make sanse on what I'm saying :)

5 gps 5 racer

Thanks Antonio

Antonio76m avatar Apr 08 '17 14:04 Antonio76m

Heading should move.

But what does the mag light show? And what magnetometer is actually selected and have you tried doing a new auto detect mag?

oleost avatar Apr 08 '17 15:04 oleost

Also what does the accelerometer sensor light give you?

oleost avatar Apr 08 '17 15:04 oleost

what do you mean with "mag light" and "accelerometer sensor light" ? are you referring to the attached? yes I've tried MAG auto detect and it gives me the HMC5883 thanks EDIT: second screen are sensors with 5" racer preset

sensors

sensors racer

Antonio76m avatar Apr 08 '17 16:04 Antonio76m

as I'm not expert, below the only difference I can see, I changed them but still problem persist thanks pid racer pid gps

Antonio76m avatar Apr 08 '17 16:04 Antonio76m

Hmm, can confirm issues. Unsure why its like this. Guess we have to wait for someone else to come online. Also it does this without having mag enabled, the board I tested on is magless board.

It appears when enabling the notch filter.

set gyro_notch1_hz = 400
set gyro_notch1_cutoff = 300
set gyro_notch2_hz = 200
set gyro_notch2_cutoff = 100
set dterm_lpf_hz = 80
set dterm_notch_hz = 260
set dterm_notch_cutoff = 160

This is raw diff dump from GPS preset. When this is applied GUI model is shaky, heading is not working. ( it actually shows heading change when pitching, instead of when yawing.

Diff:

INAV/SPRACINGF3 1.6.1 Mar  9 2017 / 00:47:57 (6c878ae)
set gyro_sync = ON
set gyro_hardware_lpf = 188HZ
set gyro_lpf_hz = 90
set gyro_notch1_hz = 400
set gyro_notch1_cutoff = 300
set gyro_notch2_hz = 200
set gyro_notch2_cutoff = 100
set acc_hardware = MPU6050
set mag_hardware = NONE
set baro_hardware = MS5611
set motor_pwm_rate = 1000
set motor_pwm_protocol = ONESHOT125
set dterm_lpf_hz = 80
set dterm_notch_hz = 260
set dterm_notch_cutoff = 160
set roll_rate = 50
set pitch_rate = 50
set yaw_rate = 45

Removing the notch changes it behaves as expected:

Diff:

INAV/SPRACINGF3 1.6.1 Mar  9 2017 / 00:47:57 (6c878ae)
set gyro_sync = ON
set gyro_hardware_lpf = 188HZ
set gyro_lpf_hz = 90
set acc_hardware = MPU6050
set mag_hardware = NONE
set baro_hardware = MS5611
set motor_pwm_rate = 1000
set motor_pwm_protocol = ONESHOT125
set roll_rate = 50
set pitch_rate = 50
set yaw_rate = 45

@DzikuVx Any idea?

oleost avatar Apr 08 '17 17:04 oleost

hmm... I do not have SPRF3 to confirm, but:

  1. I'm using GPS with SPRF and notches on my big quad, no problems
  2. There is a chance that it is connected with overall system load. With notch enable, it's just too much

@oleost could you verify with i2c_overclock = ON ?

DzikuVx avatar Apr 08 '17 19:04 DzikuVx

Hi guys, I've also a spare SP RACING F3 EVO, still to be soldered etc, I'v installed latest iNav as per F3 Deluxe and the problem still persist also in the other board "naked" no motors, GPS etc connected, just the board. thanks

Antonio76m avatar Apr 08 '17 19:04 Antonio76m

@Antonio76m SP Racing F3 deluxe has a HMC5883 built in. Many GPS boards come with that same sensor. Do you have a board without the HMC5883 to test the gps module's compass? It could be a conflict of 2 identical chips on your i2c bus. As for the notch filter, you should check cpu load and task timing. (maybe post output of "tasks") Notch filters only work if the desired sampling rate is achieved, if not they will produce garbage, for example if you set sampling rate to 1000 and it only achieves 600, it's bad. I would start by overclocking i2c. F3 boards with SPI wired gyro are fast enough for async gyro at 4k, F1 boards run too slow a looptime to be bothered by slow i2c, but on F3 boards with i2c gyro, the bottle neck is the i2c bus. Oh, and one more thing, did you check your mag alignment? It is usually different for external, and sometimes even upside down. (you can see it is upside down when the model rotates the wrong way when you turn it slowly)

WaspFPV avatar Apr 08 '17 21:04 WaspFPV

@andre92 thanks for the reply, thing is my GPS has no MAG in it, so no conflict there :( I did try set i2c_overclock=ON just now but it does not solve the issue

Antonio76m avatar Apr 08 '17 21:04 Antonio76m

Does it show any i2c errors? and could you post the output of the commands "status" and "tasks"?

WaspFPV avatar Apr 08 '17 21:04 WaspFPV

how do I do that? sorry I'm not expert :(

Antonio76m avatar Apr 08 '17 21:04 Antonio76m

You can type those commands into the CLI. (without the quote marks) It should output the rate and duration of each task. That way we can determine whether the cpu is overloaded. Please paste the output for both commands, and put them into code tags. Paste, select and press this button: <>

WaspFPV avatar Apr 08 '17 21:04 WaspFPV

System Uptime: 12 seconds Voltage: 11 * 0.1V (1S battery - CRITICAL) CPU Clock=72MHz, GYRO=MPU6050, ACC=MPU6050.n, BARO=MS5611, MAG=HMC5883 Sensor status: GYRO=OK, ACC=OK, MAG=OK, BARO=OK, SONAR=NONE, GPS=NONE Stack size: 2048, Stack address: 0x10002000 I2C Errors: 0, config size: 3234, max available config: 4096 System load: 4, cycle time: 2018, PID rate: 495, RX rate: 49, System rate: 9

`acc_task_frequency = 500 Allowed range: 100 - 1000

attitude_task_frequency = 250 Allowed range: 100 - 1000`

Task list rate/hz max/us avg/us maxload avgload total/ms 0 - SYSTEM 9 5 3 0.5% 0.5% 2 1 - PID 495 717 689 35.9% 34.6% 22274 5 - RX 49 116 107 1.0% 1.0% 366 6 - SERIAL 99 134 5 1.8% 0.5% 156 7 - BATTERY 49 40185 6 197.4% 0.5% 62 8 - BEEPER 99 23 11 0.7% 0.6% 72 9 - GPS 24 129 19 0.8% 0.5% 25 10 - COMPASS 9 236 233 0.7% 0.7% 154 11 - BARO 99 246 240 2.9% 2.8% 1588 15 - LEDSTRIP 99 406 248 4.5% 2.9% 1800 17 - CMS 59 8 5 0.5% 0.5% 18 Task check function 7 6 17 Total (excluding SERIAL) 244.9% 44.6%

Antonio76m avatar Apr 08 '17 21:04 Antonio76m

Status looks ok to me, no i2c errors and if "system load" is in percent, that would mean 4% load and maybe you could run it at 1khz too. Could you post the output of the "tasks" command as well?

WaspFPV avatar Apr 08 '17 21:04 WaspFPV

Task list rate/hz max/us avg/us maxload avgload total/ms 0 - SYSTEM 9 5 3 0.5% 0.5% 2 1 - PID 495 717 689 35.9% 34.6% 22274 5 - RX 49 116 107 1.0% 1.0% 366 6 - SERIAL 99 134 5 1.8% 0.5% 156 7 - BATTERY 49 40185 6 197.4% 0.5% 62 8 - BEEPER 99 23 11 0.7% 0.6% 72 9 - GPS 24 129 19 0.8% 0.5% 25 10 - COMPASS 9 236 233 0.7% 0.7% 154 11 - BARO 99 246 240 2.9% 2.8% 1588 15 - LEDSTRIP 99 406 248 4.5% 2.9% 1800 17 - CMS 59 8 5 0.5% 0.5% 18 Task check function 7 6 17 Total (excluding SERIAL) 244.9% 44.6%

Antonio76m avatar Apr 08 '17 21:04 Antonio76m

Github is messing with the code tags

Task list rate/hz max/us avg/us maxload avgload total/ms 
0 - SYSTEM    9 5 3 0.5% 0.5% 2 
1 - PID      495 717 689 35.9% 34.6% 22274 
5 - RX       49 116 107 1.0% 1.0% 366 
6 - SERIAL   99 134 5 1.8% 0.5% 156 
7 - BATTERY   49 40185 6 197.4% 0.5% 62 
8 - BEEPER     99 23  11  0.7% 0.6% 72 
9 - GPS        24 129 19  0.8% 0.5% 25 
10 - COMPASS    9 236 233 0.7% 0.7% 154 
11 - BARO      99 246 240 2.9% 2.8% 1588 
15 - LEDSTRIP  99 406 248 4.5% 2.9% 1800 
17 - CMS       59 8   5   0.5% 0.5% 18 
Task check function 7 6 17 Total (excluding SERIAL) 244.9% 44.6%

WaspFPV avatar Apr 08 '17 21:04 WaspFPV

btw I've tested all the preset, just in case, and the issue happen only with 5" GPS, all other preset looks good.

Antonio76m avatar Apr 08 '17 21:04 Antonio76m

@oleost @Antonio76m what is your gyro_rate_denom set to?

digitalentity avatar Apr 09 '17 00:04 digitalentity

@digitalentity This preset was applied on a clean board, so gyro_sync_denom = 2

Tried changing to gyro_sync_denom = 4, did not help.

oleost avatar Apr 09 '17 05:04 oleost

@oleost this is the problem. Default preset samples gyro at 500Hz, meaning only frequencies up to 250Hz (Nyquist frequency) can be detected, sampled and filtered. However our notch filter is set to 400Hz center frequency which is waaay above the Nyquist frequency.

We need to either disable notch or set it to something that is compatible with 500Hz sampling rate.

digitalentity avatar Apr 09 '17 05:04 digitalentity