Minor fixes, enhancements and cleanups
This release has a couple of small fixes and also gets rid of a couple of really bone-headed bugs in the Dexter Industry IMU sensor driver.
The sensor driver has been tested with a real segway by Laurens Valk, check out the video below:
The new IMU driver now also features the ability to switch on the built-in Low Pass Filtering to reduce the number of transient spikes in the readings. You can see a nice little graph below comparing readings with and without the filter enabled. These readings were taken with the DIMU-test2.c program, which is provided with the driver suite. The sensor was kept stationary during the measurements.
Without Low Pass Filter |
With Low Pass Filter |
Other than the DIMU driver enhancements, I also made following changes:
- Fixed an old bug in FLAC that somehow managed to survive for this long
- Fixed some comments in HTIRS2-driver
Where can I download it?
You can get it at the usual place: [LINK].
Thank you
Aswin Bouwmeester and John Hansen for very helpful tips and pointing out some really dumb bits of code in my drivers.
“FLAC” as in the audio format, “Free Loseless Audio Codec”?
Take a look in the FLAC driver to see what it is 🙂
I am having problems getting consistent readings from mine (it tends to provide large drift spikes of 5 dpm at times, always in a positive direction on the Z-axis), but they seemed to clear up a bit more when I modified the I2C address from 0xD2 to 0xD3.
#define DIMU_GYRO_I2C_ADDR 0xD3 /*!< Gyro I2C address */
Looking at the data sheets provided by Dexter, I believe the I2C address may be different now?
Prior to changing the constant it worked (not sure why it would work at all, but perhaps it's because it's the only I2C device on the the port). However, I couldn't get the X axis to read reliably if I just read the X-axis. Occasionally, it'll also refuse to initialize, which requires rebooting my NXT. I haven't tried 'rebooting' the IMU, but I'll try that next.
It seems way more sensitive and much noisier than the single-axis Hi-technic sensor I was using in the past, but the price is much better since I'm getting 6 sensors for about 20% more than a single sensor.
Hi Nate,
Changing the read address from an even to an odd address won’t really help. The last bit is pretty much ignored by ROBOTC and changed as needed to go from a read to a write action on the bus.
Which version of ROBOTC are you using?
– Xander
I’m using 3.04. I’m not sure what’s going on, but it appears to be working more consistently now. However, the gyro it is *very* noisy, and tends to drift much more than the HiTechnics sensor I borrowed.
I tried enabling in the high-pass filter (which logically should get rid of the high-frequency bouncing noise), but in fact, the HPF is less of a high-pass filter and more of a rate limiter. I also think I got the temperature sensor working, but I’m not fully comfortable with the I2C code or the conversion of the results back to Robotc data types.
Thanks!
Can you mail me the output of DIMU-test2.c? Copy and paste the output of the debug console into a mail so I can take a look at it.
Will do.
I don’t have your email. However, I am getting *very* wild results.
Most look something like:
-0.031250, 1.289063, 0.515625
0.164063, 1.117188, 0.476563
0.164063, 1.117188, 0.398438
But, occasionally something really bad happens.
828125, 0.187500, 0.156250
1.007813, 0.156250, 0.367188
I’m (hoping) it was a cut-n-paste error. However, it’s late, so I’ll revisit this again tomorrow.
Thanks!
Turns out that it was over-writing itself in the debugger stream window. I modified the wait from wait1Msec(2) -> wait1MSec(5), and the output looks less funky.
However, I’m still seeing very ‘spikey’ results. I’m going to do some statistical analysis on them to see if they are unrealistic.
It may be that I had a good Hi-Technic sensor (low drift), as I was seeing about 1 degree of drift every minute or so, vs. the DIMU at ~1 degree every couple of seconds.
In analyzing the data, the LPF is working. My sensor is just really noisey… My filtered results look like your pre-filtered results above, but when I disable the LPF, it gets much worse.
Time to look into Kalman filters. 🙂