MWC R1232 has a bug in ALT reading
MWC R1232 has a bug in ALT reading
Using Crius AIOP with MS6511 baro on Mega 2560, Altitude graph shows strange negatives values some times or even flat after a while
Rolling back on previous MWC 1171 and everything works normal on the same controller.
Rolling back on previous MWC 1171 and everything works normal on the same controller.
Re: MWC R1232 has a bug in ALT reading
Hi,
the same here. After uploading the new R1232, alt shows constantly 0.00 .
Rolling back to R1177 shows real datas.
BR
Adrian
the same here. After uploading the new R1232, alt shows constantly 0.00 .
Rolling back to R1177 shows real datas.
BR
Adrian
Re: MWC R1232 has a bug in ALT reading
looks like r1188 has some major baro code change
Re: MWC R1232 has a bug in ALT reading
The code changed to show relative (to ground level) altitude and is reading the barometer at a much faster rate now. It should be 0m at ground and can go to negative values with changing air pressure (which is ok). However it shouldn't show 0.00 all the time, what board/sensor combination do you use, nhadrian?
Re: MWC R1232 has a bug in ALT reading
Immediately after software update to R1232, GUI showed on ALT graph -25000m or something like that and a wild baro graph with ups and downs, then i rebooted and worked nice for a while, i was impressed how smooth worked. In this period I observer that wen calibrating giro, the ALT graph had a sudden upwards spike.
After a few minutes i observed a flat graph....0...and stayed there regardless what i did: reset, blowing air in sensor, shaking it.
There were no indication of I2C errors, the other sensors worked as expected.
After a few minutes i observed a flat graph....0...and stayed there regardless what i did: reset, blowing air in sensor, shaking it.
There were no indication of I2C errors, the other sensors worked as expected.
Re: MWC R1232 has a bug in ALT reading
dramida wrote:Immediately after software update to R1232, GUI showed on ALT graph -25000m or something like that and a wild baro graph with ups and downs, then i rebooted and worked nice for a while, i was impressed how smooth worked. In this period I observer that wen calibrating giro, the ALT graph had a sudden upwards spike.
After a few minutes i observed a flat graph....0...and stayed there regardless what i did: reset, blowing air in sensor, shaking it.
There were no indication of I2C errors, the other sensors worked as expected.
That is strange, I am also using the Mega2560 with the MS6511 baro and haven't had these problems (just checked out r1232). There is an upward spike of around 60 cm when calibrating gyro or accelerometer, but you can't really trust any values during calibration. A flat 0 graph shouldn't be possible (only for the first 10 seconds after bootup). Can you reproduce this behaviour?
I'll let it sit on the floor for a few minutes to see how altitude changes.
Re: MWC R1232 has a bug in ALT reading
Hi,
I can reproduce this every time... I holded on the floor for 1 minute and still 0.00
BTW I printed the baroPressure/10 to debug , it seems valid data, so the reading of MS5611BA is working. Something should be with the calculations after...
BR
Adrian
I can reproduce this every time... I holded on the floor for 1 minute and still 0.00
BTW I printed the baroPressure/10 to debug , it seems valid data, so the reading of MS5611BA is working. Something should be with the calculations after...
BR
Adrian
Re: MWC R1232 has a bug in ALT reading
I forgot to mention, as octo's are not quite common, the crius FC is configured in Octo flat plus. Does anyone have a working altitude on R1232 MWC? I need to hear some success stories
Re: MWC R1232 has a bug in ALT reading
Hello,
I´d like to test the new r1232 but its just 10 bytes to big for my config ( i2c-GPS,HMC 5843,BMP 085 32u4 - nanowii board )
" Binary sktch size: 28,682 bytes ( of a 28,672 byte maximum) "
I have already undifened evrething of the unneeded usual cofig.h settings.
Does anybody know how to spare some more bytes of the code but without loosing the GPS,BARO + MAG on 32u4. ( dev r 1143 works already very fine on Nananowii)
thank you
Georg
I´d like to test the new r1232 but its just 10 bytes to big for my config ( i2c-GPS,HMC 5843,BMP 085 32u4 - nanowii board )
" Binary sktch size: 28,682 bytes ( of a 28,672 byte maximum) "
I have already undifened evrething of the unneeded usual cofig.h settings.
Does anybody know how to spare some more bytes of the code but without loosing the GPS,BARO + MAG on 32u4. ( dev r 1143 works already very fine on Nananowii)
thank you
Georg
Re: MWC R1232 has a bug in ALT reading
I had a version which combines gyro and acc readout for the mpu6050 (nanowii) that saves a few bytes, but it is not yet included in MultiWii.
@nhadrian can you post you config.h settings and mabye debug the following values:
- baroGroundPressure (should be whatever the ground pressure is, after 10 seconds)
- BaroAlt (unfiltered alttitude)
Maybe your plattform initialisation is taking longer than 10 seconds so baroGroundPressure stays 0 ... that would explain why the altitude shows a 0 too ... I planned to include some code that would reset baroGroundPressure when arming the copter/plane, that could work or you test different values for INIT_DELAY in Imu.ino (maybe 20000000? for a 20 seconds delay?)
@nhadrian can you post you config.h settings and mabye debug the following values:
- baroGroundPressure (should be whatever the ground pressure is, after 10 seconds)
- BaroAlt (unfiltered alttitude)
Maybe your plattform initialisation is taking longer than 10 seconds so baroGroundPressure stays 0 ... that would explain why the altitude shows a 0 too ... I planned to include some code that would reset baroGroundPressure when arming the copter/plane, that could work or you test different values for INIT_DELAY in Imu.ino (maybe 20000000? for a 20 seconds delay?)
- jevermeister
- Posts: 708
- Joined: Wed Jul 20, 2011 8:56 am
- Contact:
Re: MWC R1232 has a bug in ALT reading
polo_fly2 wrote:Hello,
I´d like to test the new r1232 but its just 10 bytes to big for my config ( i2c-GPS,HMC 5843,BMP 085 32u4 - nanowii board )
" Binary sktch size: 28,682 bytes ( of a 28,672 byte maximum) "
I have already undifened evrething of the unneeded usual cofig.h settings.
Does anybody know how to spare some more bytes of the code but without loosing the GPS,BARO + MAG on 32u4. ( dev r 1143 works already very fine on Nananowii)
thank you
Georg
have you installes a buzzer or a pl?
Re: MWC R1232 has a bug in ALT reading
jevermeister wrote:have you installes a buzzer or a pl?
hi jevermeister,
have no buzzer, no lcd, no vbat , (what is pl ?)
but I got the right size for 32u4, ( I could undefine this one : //#define DEADBAND 6 )
now the sketch is 18,668 bytes ( 4 bytes left ), so I can test now..
anyway thank you for thinking about
georg
- jevermeister
- Posts: 708
- Joined: Wed Jul 20, 2011 8:56 am
- Contact:
Re: MWC R1232 has a bug in ALT reading
pl is a pilotlamp.
You should undefine as much as possible or get a bigger FC.
I know this sucks, but if you are using GPS and stuff you should invest some money into a new FC.
And if you are spending money into a new fc: perhaps get a 32bit controller. (you are VERY welcome TC)...
Nils
You should undefine as much as possible or get a bigger FC.
I know this sucks, but if you are using GPS and stuff you should invest some money into a new FC.
And if you are spending money into a new fc: perhaps get a 32bit controller. (you are VERY welcome TC)...
Nils
Re: MWC R1232 has a bug in ALT reading
jevermeister wrote:pl is a pilotlamp.
You should undefine as much as possible or get a bigger FC.
Nils
you are right. Before it was not my plan to go with all that GPS stuff. But I like the Nanowii, it is the third one I use, of course
with GPS, its on extreme limit, but it works. I had the Magneto and Baro since release MW1.6, but did not use them because it was a bit frustating.
Now the things changed rapidly positive with all the new code. For he next copter I will go probably again to a bigger Processor again.
For my current one I am too lazy to disassamble everything, It flies too good already.
But sorry: this thread is relating to the "bug in ALT reading". I did not want to distract from
georg
Re: MWC R1232 has a bug in ALT reading
Sebbi wrote:@nhadrian can you post you config.h settings and mabye debug the following values:
- baroGroundPressure (should be whatever the ground pressure is, after 10 seconds)
- BaroAlt (unfiltered alttitude)
Maybe your plattform initialisation is taking longer than 10 seconds so baroGroundPressure stays 0 ... that would explain why the altitude shows a 0 too ... I planned to include some code that would reset baroGroundPressure when arming the copter/plane, that could work or you test different values for INIT_DELAY in Imu.ino (maybe 20000000? for a 20 seconds delay?)
Hi,
I tried to raise the Interval to 20s, still the same.
I plotted the BaroAlt and baroGroundPressure values, both are 0 for more than 2 minutes... :(
The raw pressure data is valid, when I move the copter up or down it reacts as it should.
BR
Adrian
- Crashpilot1000
- Posts: 631
- Joined: Tue Apr 03, 2012 7:38 pm
Re: MWC R1232 has a bug in ALT reading
Hi!
I have freeimu 0.3.5 MS running with promini and altitude is shown correctly.
By the way i did two cut down versions of the current dev without sacrificing any functionality, but it will get slower (slight increase of cycletime).
I did a -58 Byte Version and a -222Byte Version - the more bytes saved the slower it will probably get. No severe changes, just avoiding some datatype conversions in althold and a shortcut in main PID controller for small values (so time wasted for small values, but cutting the detection saves bytes). Perhaps users on promicro benefit from it. Try it if you want. Own risk - as always. Just make a hand-test to make sure everything works like expected.
So long
Rob
I have freeimu 0.3.5 MS running with promini and altitude is shown correctly.
By the way i did two cut down versions of the current dev without sacrificing any functionality, but it will get slower (slight increase of cycletime).
I did a -58 Byte Version and a -222Byte Version - the more bytes saved the slower it will probably get. No severe changes, just avoiding some datatype conversions in althold and a shortcut in main PID controller for small values (so time wasted for small values, but cutting the detection saves bytes). Perhaps users on promicro benefit from it. Try it if you want. Own risk - as always. Just make a hand-test to make sure everything works like expected.
So long
Rob
- Attachments
-
- MultiWii_2_1_dev_r1232_SHORT.zip
- (247.71 KiB) Downloaded 236 times
Re: MWC R1232 has a bug in ALT reading
It looks like the code works on mini based FCs, maybe there is something BUG in the code which is related only to MEGA boards?
Re: MWC R1232 has a bug in ALT reading
Well, I "developed" that part of the code on a mega2560 and it works for me.
As long as baroGroundPressure is 0 the altitude will always be 0. Can you also plot/debug baroPressureSum on your copter? That should be around 20 times the value of baroPressure. You already wrote baroPressure seems valid ... very weird bug :/
Can you post your config.h? Maybe there is something interfering?
As long as baroGroundPressure is 0 the altitude will always be 0. Can you also plot/debug baroPressureSum on your copter? That should be around 20 times the value of baroPressure. You already wrote baroPressure seems valid ... very weird bug :/
Can you post your config.h? Maybe there is something interfering?
Re: MWC R1232 has a bug in ALT reading
Hi,
I attached my Multiwii.
BaroPressureSum looks like is not 0, plotted to debug1 divided by 100 and shows around 19000 so maybe a really big number indeed.
BR
Adrian
I attached my Multiwii.
BaroPressureSum looks like is not 0, plotted to debug1 divided by 100 and shows around 19000 so maybe a really big number indeed.
BR
Adrian
- Attachments
-
- MultiWii.zip
- (129.07 KiB) Downloaded 202 times
Re: MWC R1232 has a bug in ALT reading
Tested now r1233 on AIOP and no problem, at ground it shows 0,0 - 0,2 m and when will lift it shows 2m as should.
Re: MWC R1232 has a bug in ALT reading
in r1232 baro reading in gui wac -25000 or more. I've rebooted fc then value shown in gui was 0. But when testing outside, quad was going up. Like baro wasn't working. In r1177 baro readings in gui is around 800. I live at 660m abowe sea level. But it works. Slightly goes down and then up.
Last edited by scrat on Sat Oct 27, 2012 8:53 pm, edited 1 time in total.
Re: MWC R1232 has a bug in ALT reading
nhadrian wrote:Hi,
I attached my Multiwii.
BaroPressureSum looks like is not 0, plotted to debug1 divided by 100 and shows around 19000 so maybe a really big number indeed.
BR
Adrian
Your config.h looks pretty default and 19000 is in the correct range when devided by 100 (equals 950 mbar pressure). I'll try to come up with something to fix it for your configuration, but so far ... I'm clueless. You could try to replace
Code: Select all
if(baroGroundPressure == 0 && currentTime > INIT_DELAY) { // 10 seconds delay
with
Code: Select all
if(currentTime > INIT_DELAY) { // 10 seconds delay
and see if baroGroundPressure gets set to something then ... this wont show you the correct altitude since it will reset ground every cycle, but at least you can see if this is causing the problem.
Re: MWC R1232 has a bug in ALT reading
Sebbi wrote:nhadrian wrote:Hi,
Your config.h looks pretty default and 19000 is in the correct range when devided by 100 (equals 950 mbar pressure). I'll try to come up with something to fix it for your configuration, but so far ... I'm clueless. You could try to replaceCode: Select all
if(baroGroundPressure == 0 && currentTime > INIT_DELAY) { // 10 seconds delay
withCode: Select all
if(currentTime > INIT_DELAY) { // 10 seconds delay
and see if baroGroundPressure gets set to something then ... this wont show you the correct altitude since it will reset ground every cycle, but at least you can see if this is causing the problem.
I tried. baroGroundPressure stays constantly on 0 after aa minute too.
Re: MWC R1232 has a bug in ALT reading
You can try
or debug currentTime and INIT_DELAY ...
I don't get it why baroPressureSum has some value, but baroGroundPressure stays 0.
Code: Select all
baroGroundPressure = 100;
if(currentTime > INIT_DELAY) { // 10 seconds delay
or debug currentTime and INIT_DELAY ...
I don't get it why baroPressureSum has some value, but baroGroundPressure stays 0.
Re: MWC R1232 has a bug in ALT reading
Hi,
Still nothing here. The interresting is that once I write in number instead of baroGroundPressure into the Baroalt = ..... equation, it still remains 0.
BR
Adrian
Still nothing here. The interresting is that once I write in number instead of baroGroundPressure into the Baroalt = ..... equation, it still remains 0.
BR
Adrian
Re: MWC R1232 has a bug in ALT reading
Hi,
I found the origin!!!
After some other tests I realised that getEstimatedAltitude is never excited!
To proove that, I replaced this part:
to this:
and it works!!! Now it shows latitude after 10 minutes, also I have valid baroGroundPressure, etc...
So either there is no case when Baro_update gives 0 or similar problem.
Could you please look after?
BR
Adrian
I found the origin!!!
After some other tests I realised that getEstimatedAltitude is never excited!
To proove that, I replaced this part:
Code: Select all
if (Baro_update() != 0 ) {
break;
} else {
if (getEstimatedAltitude() !=0) {
break;
}
}
to this:
Code: Select all
Baro_update();
getEstimatedAltitude();
break;
and it works!!! Now it shows latitude after 10 minutes, also I have valid baroGroundPressure, etc...
So either there is no case when Baro_update gives 0 or similar problem.
Could you please look after?
BR
Adrian
Re: MWC R1232 has a bug in ALT reading
The only possibility Baro_update() would never return 0 is when other stuff is taking longer than 10 ms ... i don't know how this could be the case. Is your average cycleTime higher than normal, e.g. in the 10000 range?
Re: MWC R1232 has a bug in ALT reading
Or ... with GPS active and when it is slow enough (you had a baudrate auf 57600 and ublox, I don't know about that) and maybe Sonar it would be easily possible that Baro_update gets only called every 10000 µs and then getEstimatedAltitude would never execute. This needs to be fixed by giving getEstimatedAltitude its own case in the switch statement.
Re: MWC R1232 has a bug in ALT reading
Yesterday i re-tested R1232 on a totally different copter: Criuss AIOP with Ublox serial GPS in quad configuration. Altitude readings behave strangely, first it shows a high negative altitude (-26000 or so) witch is not so stable (worst than bmp085) and after a few minutes it freezes to 0
I am surprised that from all 808 users who downloaded this MWC version, only I and Adrian reported this issue.
I am surprised that from all 808 users who downloaded this MWC version, only I and Adrian reported this issue.
Re: MWC R1232 has a bug in ALT reading
I have cícle time around 3000-4000, so this couldn't be the origin.
BTW, I modified the code, gave own case for getEstimatedAltitude, now it works fine.
Dramida, could you please also try to add own case for getEstimatedAltitude?
Like this way?
BTW, I modified the code, gave own case for getEstimatedAltitude, now it works fine.
Dramida, could you please also try to add own case for getEstimatedAltitude?
Like this way?
Code: Select all
switch (taskOrder % 5) {
case 0:
taskOrder++;
#if MAG
if (Mag_getADC()) { // max 350 µs (HMC5883)
break; // only break when we actually did something
}
#endif
case 1:
taskOrder++;
#if BARO
Baro_update();
break;
#endif
case 2:
taskOrder++;
#if BARO
getEstimatedAltitude()
break;
#endif
case 3:
taskOrder++;
#if GPS
if(GPS_Enable) {
GPS_NewData();
}
break;
#endif
case 4:
taskOrder++;
#if SONAR
Sonar_update();debug[2] = sonarAlt;
#endif
#ifdef LANDING_LIGHTS_DDR
auto_switch_landing_lights();
#endif
break;
}
Re: MWC R1232 has a bug in ALT reading
dramida wrote:Yesterday i re-tested R1232 on a totally different copter: Criuss AIOP with Ublox serial GPS in quad configuration. Altitude readings behave strangely, first it shows a high negative altitude (-26000 or so) witch is not so stable (worst than bmp085) and after a few minutes it freezes to 0
I am surprised that from all 808 users who downloaded this MWC version, only I and Adrian reported this issue.
You didn't read my post:
in r1232 baro reading in gui was -25000 or more. I've rebooted fc then value shown in gui was 0. But when testing outside, quad was going up. Like baro wasn't working. In r1177 baro readings in gui is around 800. I live at 660m abowe sea level. But it works. Slightly goes down and then up.
Re: MWC R1232 has a bug in ALT reading
scrat wrote:in r1232 baro reading in gui was -25000 or more. I've rebooted fc then value shown in gui was 0. But when testing outside, quad was going up. Like baro wasn't working. In r1177 baro readings in gui is around 800. I live at 660m abowe sea level. But it works. Slightly goes down and then up.
So already 3 persons... ?!?!?!
Re: MWC R1232 has a bug in ALT reading
+1, BMP085, B2 release is good, but R1232 is jump up and down.
Re: MWC R1232 has a bug in ALT reading
Is this always a crius board with ublox serial?
In the baro case can you measure the time from one call of baro_update to the next?
It could be worse for bmp085 because it switches between deadlines of 8 and 14 MS ...
The solution with separate tasks should be the fix for this Kind of problem however.
In the baro case can you measure the time from one call of baro_update to the next?
It could be worse for bmp085 because it switches between deadlines of 8 and 14 MS ...
The solution with separate tasks should be the fix for this Kind of problem however.
Re: MWC R1232 has a bug in ALT reading
I measured the timing of the code:
This is not optimal scheduling. For the MS6511 baro_update should be called every 10 ms, but it is more like 14-16 ms and only sometimes 10 ms when the cycles added up enough time. GetEstimatedAltitude has an internal "timer" which prevents executions if less than 25 ms have passed since the last execution. Well ... with GPS enabled this mechanism is not really needed, because the function gets called with only 10-15 Hz (on my copter) or never with some other configurations (nhadrian and others).
I suggest a complete rework of the scheduler and timing sensitive code In the meantime, this should work as a fix:
If baro is enabled, GPS still gets called every 6 - 20 ms which is faster than the 10 Hz they usually send data with.
- With serial GPS enabled (NMEA, with or without a GPS connected) the time between two baro_update calls is only seldomly below 10000 µs, so getEstimatedAltitude doesn't get called often enough. With Ublox, Sonar lower baudrate and/or BMP085 this issue could be even worse
- Without GPS enabled the time between two calls is below 10000 more often, but occasionally goes over 10000
This is not optimal scheduling. For the MS6511 baro_update should be called every 10 ms, but it is more like 14-16 ms and only sometimes 10 ms when the cycles added up enough time. GetEstimatedAltitude has an internal "timer" which prevents executions if less than 25 ms have passed since the last execution. Well ... with GPS enabled this mechanism is not really needed, because the function gets called with only 10-15 Hz (on my copter) or never with some other configurations (nhadrian and others).
I suggest a complete rework of the scheduler and timing sensitive code In the meantime, this should work as a fix:
Code: Select all
static uint8_t taskOrder=0; // never call all functions in the same loop, to avoid high delay spikes
switch (taskOrder % 5) {
case 0:
taskOrder++;
#if MAG
if (Mag_getADC()) { // max 350 µs (HMC5883)
break; // only break when we actually did something
}
#endif
case 1:
taskOrder++;
#if BARO
if(Baro_update() != 0)
break;
#endif
case 2:
taskOrder++;
#if BARO
if(getEstimatedAltitude() != 0)
break;
#endif
case 3:
taskOrder++;
#if GPS
if(GPS_Enable) {
GPS_NewData();
}
break;
#endif
case 4:
taskOrder++;
#if SONAR
Sonar_update();debug[2] = sonarAlt;
#endif
#ifdef LANDING_LIGHTS_DDR
auto_switch_landing_lights();
#endif
break;
}
If baro is enabled, GPS still gets called every 6 - 20 ms which is faster than the 10 Hz they usually send data with.
Re: MWC R1232 has a bug in ALT reading
nhadrian wrote:scrat wrote:in r1232 baro reading in gui was -25000 or more. I've rebooted fc then value shown in gui was 0. But when testing outside, quad was going up. Like baro wasn't working. In r1177 baro readings in gui is around 800. I live at 660m abowe sea level. But it works. Slightly goes down and then up.
So already 3 persons... ?!?!?!
Here too! BIG negative values on GUI. Using CRIUS AIO PRO (MPU6050,MS5611,HMC5883L).
Re: MWC R1232 has a bug in ALT reading
Large negative values can only occur if groundpressure was measured "too early" and/or it has a value significantly lower than the current air pressure. Increasing INIT_DELAY in Imu.ino should help and getting a new groundpressure value when arming and/or with a stick command should help too. Maybe add it to the gyro calibration command?
Re: MWC R1232 has a bug in ALT reading
Here is a working and improved (baro calibration at startup and with gyro calibration stick combo) version:
https://github.com/sebastianherp/multiw ... roved_baro
Diff:
https://github.com/sebastianherp/multiw ... roved_baro
The particular commit:
https://github.com/sebastianherp/multiw ... 5dbc78983e
If someone on the MultiWii dev team would implement it, that would be swell
https://github.com/sebastianherp/multiw ... roved_baro
Diff:
https://github.com/sebastianherp/multiw ... roved_baro
The particular commit:
https://github.com/sebastianherp/multiw ... 5dbc78983e
If someone on the MultiWii dev team would implement it, that would be swell
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: MWC R1232 has a bug in ALT reading
Hi,
There is obviously something wrong about R1232, mainly due to the scheduler part.
Thank you all for digging into the code problem.
@Sebbi, I like the new approach to calibrate the baro, and I've included the mods.
a new dev is coming for testing.
There is obviously something wrong about R1232, mainly due to the scheduler part.
Thank you all for digging into the code problem.
@Sebbi, I like the new approach to calibrate the baro, and I've included the mods.
a new dev is coming for testing.