-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After reboot, pressure data is missing for several seconds #28
Comments
@kedder Sure... Can you or @Blaubart provide more detail:
Any additional helpful details? How reproducible? Honestly, I have a new version that I'm getting very close to releasing. I can probably release it tomorrow. I'm not really interested in debugging the current version at this point. So, I might prefer to make the new release and then if the problem still exists try to debug it. |
It is easy to reproduce:
With 6fa4005 reverted, sensors become responsive immediately. |
Okay... If for some reason the pressure readings were constant, that might explain why the vario is zero. I may have increased the startup time, but I wouldn't expect it to be outputting anything during that time. What about the pitot/airspeed reading? Is that 0 the whole time (did you try blowing into the pitot to force it to read something? |
I think I may know the cause and think it's been corrected in the new version. There's an "if (glitch<2)" in the pressure_measurement_handler(). When I was looking at the code during the latest (not yet released) update, I couldn't figure out why it was there and removed it. It could definitely suppress the output on start up. |
I have pushed a new version into hpmax/sensord. Please try it and see if it fixes it and if everything seems to be working. Also, please try "compdata"... Usage is: "compdata -s -c /opt/conf/sensord.conf" It'll ask how many thousands of data points. It'll take about one minute per thousand data points, so start off with a few to see how it goes. I am now suspecting there is a temperature and/or pressure dependent on the compensation. I'm going to experiment with that to try to improve things in the next week or two. |
@hpmax the version in master branch of https://github.com/hpmax/sensord does not build cleanly:
|
The @hpmax do you have a way to test your version of |
The complaint about int j=0; doesn't bother me much -- just an extraneous variable declaration. I'm not sure what to make of the can't make target cal (I presume that's sensorcal). I don't know what to say about that. When analyzing data, I typically ignore the first 1000 samples (which should roughly correlate to 20 seconds). There is a lot of ugliness when the thing first starts running related to the glitch behavior. I.e. it has to "warm up" and it takes some time after you establish a constant polling rate before the ms5611s stabilize. Also, for reasons that I still don't understand, running it in the foreground does give better results. The standard deviation of the data is lower. Not a lot lower, but it is consistently lower. It is possible that without having a stabilized value, the anti-glitch compensation is actually making things worse during startup. The glitch compensation is pretty straightforward but knowing when to turn it on and off is a big deal, because when it's turn on the D2 filter shuts off, which means if the D2 drifts too far from the filtered value it may never shut off. The new code (the one you just tried) will shut off automatically after some period of time even if it doesn't think the glitch is over. There's really no perfect solution here, but I can try to improve the startup behavior. Right now, my audio amplifier broke... again. So I'm going to have to pull it out of the glider to fix it, but I'm working on a test fixture that I can run it in my house. |
I pulled my OV out of the glider and have it wired up to the power supply so I can now operate it in doors. With OV running XCSoar, I logged into the device, killed sensord and restarted 5 times, and each time I saw the behavior:
Pretty sure I'm using the code I gave you. Am I missing something? |
Sorry, I'm not a programmer and not able to understand everything you are talking about. Is the problem solved? Thanks! |
As stated, I am unable to replicate the problem in hpmax/sensord. I am working on a new version to try to deal with the fact that glitch compensation is pressure dependent -- once complete, I will do a PR and hopefully get everything caught up. |
thanks |
I compiled now including commit d85a7a6 and sensord works perfect |
Sorry, I basically dropped off here. Been trying to deal with other issues, mainly the audio. I no longer have any confidence in Stefan's audio amplifier. I've built my own which I think will be more reliable. The new board being layout out by DanD222 should take advantage of what I've learned and be pretty solid, particularly if an 8 ohm speaker is used. What is the current status of the hpmax/sensord code? Are we still having the problem or do I need to look into this more? |
the error still exist. Sensord dosen't send data during first couple of seconds. Sometimes it takes more than 2 minutes. |
Stefan used the AS1701. I made good experiences with PAM8302. I use that one for the FreeVario |
Stefan does not use the AS1701, he uses the MAX9718 (he may have previously used the AS1701, they are pin compatible), and I wouldn't trust either the AS1701 or the MAX9718 at this point. I've killed two MAX9718s and an AS1701 at this point. The new design uses the TPA6211. From a thermal perspective, PAM8302 DFN package looks decent, the others seem more questionable. Unfortunately, DFN is obsolete according to Digikey. I can't find EMI information in the datasheet. I could have sworn I had seen some information showing it was pretty bad. Stefan told me that the Adafruit PAM8302 was a drop in replacement for his audio amp, but that it had EMI issues in some installations. Personally, I wish there was a MAX98304 with a DFN package, I'd buy that in a second. |
Okay, I just committed a new release to hpmax/sensord. I restarted at least 10 times, each time I got data out within 2-3 seconds. It's worth pointing out that because of the hardware design it necessarily will take some time for the sensor readings to be valid. Once data comes out, it can take another 4-5 seconds before the Kalman filter stabilizes This version has a switch, that can be used to deliberately inject timing glitches and provides more data in the debug output when you engage that. I've also added quadratic pressure compensation since the glitch compensation is pressure dependent and I didn't realize that in earlier versions. I still need to do more research on the pressure based compensation and compdata. it's quite possible there will be more changes. But frankly, I'm getting sick of this... Hopefully the new hardware will be available soon. Please try it and let me know. Once I've gotten good reports, and I verify compdata.c, etc I'll go for another pull request. |
Looks like everything is in better shape than I remembered it being. All the hooks for quadratic pressure compensation are in it. Let me give a more thorough explanation of what's going on here in case you haven't been paying attention to everything up to this point: If the static/TE sensors are not polled at a constant rate, glitches will occur. (this is a hardware issue with the MS5611 sensor) The gltiches are ugly and will be seen in the vario. The timing glitches can be mitigated by running sensord (and variod and pulseaudio) from the commandline or (I think) in forking mode -- but not completely eliminated. The MS5611 has both a pressure and a temperature (die, not air) sensor in it. Under normal use, we alternate taking a pressure and temperature reading and the temperature readings are used in accordance with the MS5611 datasheet to compensate the pressure readings for temperature. At any given time, we are sampling the pressure on one sensor and the temperature on the other. It has been observed that a timing glitch will result in a change of deltaT on one sensor and a change of deltaP on the other sensor, where deltaP ~ deltaT * K. If we filter pressure (and temperature) we can determine deltaP = (Filtered Pressure - Current pressure) and deltaT = (Filtered Temp - Current Temp). So we take Corrected Pressure = Current Pressure + (Filtereed Temp - Current Temp) * K. It should be noted that the Pressure and Temp in this case are from alternate sensors and there are two different K's (one for dTE_temp, and one for dStatic_temp). In actual implementation K is K0, K1, K2, such that we have dt^2 * K2 + dt * K1 + K0, allowing for quadratic term, although it's not a major contributor in all but the worst cases. These terms are stored in the sensord.conf file as: "static_comp", and "tek_comp" (see the file). The correction is pretty easy to implement. Knowing when a glitch occurs is pretty easy since we can detect the timing glitch. But determining when the the glitch is over is harder than it sounds. After doing all this, I decided to hook up a vacuum pump and brought all the sensors (if you want to try this -- make sure to connect ALL of the pressure connections to the vacuum source, including the pitot/dynamic) down to .4 atmospheres, and realized the correction factor was pretty far off. My plumbing slowly leaked, and so over the course of a couple hours I had data over a wide pressure range. I was able to determine quadratic coefficients (called "Pcomp") to compensate the static_comp and tek_comp. i.e. deltaTEPressure = (TE_Pressure^2TE_Pcomp2+TE_PressureTE_Pcomp1+TE_Pcomp0) * (static_comp2dTstatic^2+static_comp1dTstatic+static_comp0) Pcomp2 does very little, but is included, because... it's easy. The comp values will ~10 percent from sensor to sensor, so it's important to get correct values. Pcomp probably varies a few percent too, but remember, this is a few percent of a few percent. So figuring out exact values is less critical. It's also a pain because you'd need to rig up a vacuum pump and leaky "manifold" and give it a few hours. Without it, I just use Pcomp values that looked good on my OV. compdata will generate a full set of static_comp and tek_comp, and if run as: "compdata -c /opt/conf/sensord.conf" will read out all the necessary values from the config file and install the newly calculated ones. A typical run looks like: This program calculates compenation data to compensate for timing glitches on the static and tek sensors. The number of data points can be entered either with a regular keyboard or using the stick/rotary knobs. Total RMS error of 50-60 is good, 80 is likely the limit of what I'd expect. If any of these are outside expectations, I'd re-run. And hopefully later this year, all this nightmarish nonsense will go away with the new board. |
Thanks for your work!! I like to test hpmax/sensord and changed the following line at meta-openvario/recipes-apps/sensord/sensord-testing_git.bb But it is not so easy ;-) |
git clone https://www.github.com/hpmax/sensord cd <poky_root> I can push the compiled code onto github if you'd like -- note that for some reason my executables are much larger, I suspect I am linking additional unnecessary debug stuff into the executable but it doesn't affect anything. I also just finished a version that supports the DS18B20 temp sensor. Haven't pushed it onto github or tested it, but it compiles, and it should work. |
|
I put your binaries to /opt/bin and it works perfectly!! Thanks. I think you can make a PR. |
Apparently #25 introduced a regression: after the boot, sensord does not emit any actual pressure or vario data to the NMEA stream for several seconds. Sometimes the period is quite long - I've seen 20 or 30 seconds.
NMEA stream consist of repeated sentences like
This is evident by looking at vario needle in xcsoar: it is frozen at 0 m/s for several seconds after the boot. Reverting 6fa4005 fixes the issue: the pressure/vario data starts coming immediately.
This is also reported in Openvario/meta-openvario#107
@hpmax, can you have a look?
The text was updated successfully, but these errors were encountered: