How to correct the drift in MPU9250 IMU using DMP MotionApps v4.1 - quaternions

I'm trying to provide a visual orientation of a device in 3D using Qt. For this,I have integrated the DMP MotionApps v4.1 for a MPU9250 and obtained the Quaternion values from the MPU's FIFO register. This works perfectly fine. But when the device is left stable over a period of time (say after 20 mins), the Quaternion value(mostly Qz and sometimes Qx), start drifting slowing and my visual orientation gets changed. Is there a way to correct this drift with DMP being used? Any suggestions please..

Related

USB 2.0 "This device cannot start. (Code 10)"

This is probably a long shot question, but I try it anyway.
I'm developing hardware using PIC Microcontrollers (MicroChip). Communication is done through a FS USB 2.0 link.
I connect the microcontrollers to a Windows 10 Home edition, version 21H1, build 19043.1826. The processor is an AMD Ryzen 5 3600 6-Core Processor.
First I used the PIC18F45K50, for which everything worked fine from day one. But due to the shortages on the market, I now am experimenting with PIC18F47J53. Both microcontrollers are working fine, as I can (for example) control a MAX7219 controlled display (3 x 7-segment) and also control a bunch of LED's using an STP08CP05TTR. Clock timings seem also ok - I measured it with an oscilloscope.
These 2 microcontrollers are pretty much the same, at least for the core functionality such as USB. The differences that are relevant for the issue I'm reporting here are:
PIC18F45K50 uses internal clock of 8MHz, and has on board correction logic to keep clock synced for HS USB - this is a 5V processor
PIC18F47J53 uses a XTAL of 16MHz, all should be within the USB 2.0 specs - this is a 3.3V processor
I'm using the MPLab X IDE v5.45 with the MCC (MPLab Code Configurator) in which I setup the System Module (to set the correct clock frequencies including the 48MHz for USB) and where I configure the USB.
In both microcontrollers, the setup of the USB is exactly the same. I even checked the 4 files that are automatically generated by MCC, and except for the descriptors (I used different names), all is exactly the same.
When I connect the USB to my PC (same port), then the PIC18F45K50 works perfect. But the PIC18F47J53 gives error code 10.
This does not happen every time. For example, if I try 10 times (connect/disconnect the cable), then I had it 7 times. 1 time the device even didn't appear, and 2 other times I read "The device is working properly.". Although, in the latter case, my software that communicates with my controller isn't working, so there is still something wrong.
Based on the above, the first I would think of is some hardware issue. Although, the strange thing is that things like vendor ID (0x4D8), Product ID (0xA), BCD Device Release (0x100), Serial Number (12345678), etc... seem always to be read out correctly. If there would be a hardware problem, shouldn't I have more random issues with this as well? Or is this data read out in a slower mode than Full Speed (because that could of course explain this)?
Below are screenshots via "Device Manager / Ports (COM & LPT) / my serial device", then selecting the property in the Details.
If I compare the properties from the working microcontroller (PIC18F45K50) with the not working one (PIC18F47J53), it looks like all are exactly the same.
I also tried to compare the D- (CH1) and D+ (CH2) signals between the 2 microcontrollers with my oscilloscope. My USB knowledge is not detailed enough to interpret the signals, but what I can tell is that both look exactly the same to me, both timing wise and voltage level wise. Be aware that the CH2 signal on the PIC18F47J53 (D+), the second screenshot, is clipping in the picture below, but I measured it later and it shows the same voltage level as for the PIC18F45K50.
Does anybody here a single clue where I should look at in the first place? The good news is that I have a working and not working version, so I can start debugging step by step and compare. But some hints as where to start would be appreciated.
EDIT 24JUL2022
I did the measurement with my oscilloscope again. Now I soldered 2 wires to the USB port to be able to easily attach my probes. This time, both D- and D+ signals have a Vpp of about 3.3V. I put some cursors which also shows a pulse-width of about 84ns, which correlates with the USB HS frequency of 12MHz (should be 83.33ns).
I found the issue. The Vusb on my PIC18F47J53 had a bad (or was even not) connected. I gave it another touch of my soldering iron, and bingo! Now the "error 10" has disappeared completely, and each time I connect/disconnect it gives "This device is working properly.", and error 10 never appears. I now also see a continues signal on my oscilloscope - not one that is disappearing after a while. And I could send/receive already some commands.

Color and depth stream don't work anymore

I used until yesterday afternoon a Kinect for XBOX 360 on my computer, a MacBook Pro 15" Late 2011, whose specifications are available here. I use Windows 7 (natively installed, without using virtual machines). The version of the SDK I had installed was 1.0.
All of a sudden, from today the Kinect no longer worked. Initially I thought it was some error in my code, but I noticed that the program remained stuck at the beginning, when I called the method KinectSensor.Start().
I started looking for information on the internet. I read about a solution obtained by reinstalling the drivers. It did not work, and then I tried to install version 1.6 of the SDK. Unfortunately, even that did not work.
I've seen at this stage, there might be compatibility issues with certain USB host controllers, such as the Intel 5 Series/3400 Series Chipset USB host controller. In my case, however, there should be no problems (because there were not ever been up to yesterday):
To check if the problem was really due to the sensor, and not to my application, I run one of the test applications provided with the SDK, called Kinect Explorer. However, I encountered the same problem with this test application. After waiting about one minute, when the Kinect Explorer starts I cannot see neither the color stream, nor the depth stream, nor information about skeleton. The only thing I can do is move the Kinect up and down, changing the angle of the neck. Even the microphone array seems to work properly.
I read two interesting posts about this kind of problem: this and this, which have not been answered.
In the first of these two links, the user who reports the problem says that the hardware has been compromised. I thought the same thing myself until I started again Kinect Explore, initially with the sensor unplugged. Once started this program, I plug-in the cable, and I noticed that Kinect Explorer has marked the Kinect sensor as Connected. After a short initialization phase, I again see the color stream, while the depth stream showed an image of uniform color (green-gray):
This situation lasted a few seconds, after which the image is locked and the question came up. Also, sometimes the FPS value drops from 30 to 29.
I am able to reproduce this latter situation only after keeping the Kinect unplugged for a while (10 minutes are sufficient).
How can I solve this strange and terrible problem? Is it possible to restore the Kinect sensor, and make it works again? Or do I have to conclude that the sensor is irretrievably broken?

No readings from compass and inclinometer

I have a Samsung 700T ATIV Smart PC Pro tablet and I tried to access the different sensors using a basic Windows Store app template to test a few things out.
I used the samples from here: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465294.aspx
So far I was able to get data from the Accelerometer and the Gyrometer.
The Inclinometer and the Compass however are not giving me any data. I can instantiate them just fine (they are not null) using Compass.GetDefault(); and Inclinometer.GetDefault();. The "reading" event handlers are not getting invoked though.
I tried the Inclinometer and Compass samples from the SDK as well. Same result, no readings.
The tablet should be up-to-date according to the Samsung Updater tool.
Is there any other way how I can check whether these sensors are enabled and working?
Any help is greatly appreciated.
Update 1:
Using the Sensor Diagnostic Tool from the Windows Driver Kit (Link) I was able to get some more information (it's located in prog.files\Windows Kits\8.0\Tools\).
I get readings for the X, Y and Z values from the compass sensor but "Magnetic North Degrees" is always VT_NULL. Since the Runtime API is only giving me HeadingMagneticNorth and HeadingTrueNorth instead of the raw values, this may be the root of the problem. Screenshot
Now since there seems to be a working compass, I wonder what the issue might be. Driver related?
For the inclinator, I am not getting any readings at all using the Sensor Diagnostic Tool. X, Y and Z values are VT_NULL. Screenshot
Any other Samsung Win8 tablet owners out there willing to test this out?
Both sensors work now and are providing the expected values.
The solution was to move to a different place in the house and rotate the tablet on each axis several times. This led to a re-calibration of the sensors.
It's possible that the sensor was being distracted by strong magnetic interference which prevented it from calibrating properly.
You might need to set the reporting interval property too.

Kinect Tilt upwards setting

I just got a Kinect and I have it connected to the computer using the USB. However, I don't know how to make the kinect tilt upwards so it is not looking downwards at the desk.
The question becomes. Is there a program to control such settings?
I have installed Microsoft Kinect 1.0 Beta 2 SDK.
Here is some good tutorials on kinect motor :
http://channel9.msdn.com/Series/KinectSDKQuickstarts/Camera-Fundamentals
http://cm-bloggers.blogspot.com/2011/06/kinect-sdk-camera-tilt.html
More Resources to Start with kinect sdk :
http://blogs.msdn.com/b/eternalcoding/archive/2011/06/13/unleash-the-power-of-kinect-for-windows-sdk.aspx
http://social.msdn.microsoft.com/Forums/en-US/kinectsdknuiapi/thread/5e8c4bc0-3a5d-4309-8d95-d92199c208e0/
http://channel9.msdn.com/coding4fun/kinect/
http://www.freenect.com/
http://msdn.microsoft.com/fr-fr/windows/sdk-kinect-demo
I made this using Visual Studio Express and the Kinect SDK
http://tekk-support.com/dev/kinect/kinect_motor_control.exe
If someone can upload this somewhere permanent, that would be nice
"You should tilt the Kinect as few times as possible, to minimize wear on the sensor and to minimize tilting time. The tilt motor is not designed for constant or repetitive movement, and attempts to use it that way can cause degradation of motor function. To reduce wear, your application should change the elevation angle no more than once per second. In addition, you must allow at least 20 seconds of rest after 15 consecutive changes. If your application exceeds these limits, the tilt motor may experience a lock period during which attempting to set the elevation angle will result in an error code."
-- http://msdn.microsoft.com/en-us/library/microsoft.kinect.kinectsensor.elevationangle.aspx
You can also check the app at: http://kinecttiltcontrol.codeplex.com/

How to turn off Video Acceleration programmatically

I'm using the Windows Media Player OCX in a program runned on hundreds of computers (dedicated).
I have found out that when video acceleration is turned on to "full", on some computers it will cause the video to fail to play correct, with green squares between movies and so on. Turn the acceleration to "None" and everything is fine.
This program is runned on ~800 computers that will autoupdate my program. So I want to add to the startup to my program that it turns off the video acceleration.
The question is, how do I turn off video Acceleration programmatically?
All computers are running XP and at least the second service pack.
It would take me ages to manually logg in to all those computers and change that setting so thats why I want the program to be able to do it automagically for me.
Using the suggested process of running procmon, and filtering out unnecessary data, I was able to determine the changes in the registry when this value changed:
Full Video Acceleration:
[HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences\VideoSettings]
"PerformanceSettings"=dword:00000002
"UseVMR"=dword:00000001
"UseVMROverlay"=dword:00000001
"UseRGB"=dword:00000001
"UseYUV"=dword:00000001
"UseFullScrMS"=dword:00000000
"DontUseFrameInterpolation"=dword:00000000
"DVDUseVMR"=dword:00000001
"DVDUseVMROverlay"=dword:00000001
"DVDUseVMRFSMS"=dword:00000001
"DVDUseSWDecoder"=dword:00000001
No Video Acceleration:
[HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences\VideoSettings]
"PerformanceSettings"=dword:00000000
"UseVMR"=dword:00000000
"UseVMROverlay"=dword:00000000
"UseRGB"=dword:00000000
"UseYUV"=dword:00000000
"UseFullScrMS"=dword:00000001
"DontUseFrameInterpolation"=dword:00000001
"DVDUseVMR"=dword:00000000
"DVDUseVMROverlay"=dword:00000000
"DVDUseVMRFSMS"=dword:00000000
"DVDUseSWDecoder"=dword:00000000
So, in short, set
PerformanceSettings
UseVMR
UseVMROverlay
UserRGB
UseYUV
DVDUseVMR
DVDUseVMROverlay
DVDUseVMRFSMS
DVDUseSWDecoder
to 0, and set
UseFullScrMS
DontUseFrameInterpolation
to 1.
It seems you're not the only one with this problem. Here's a link to a blog - the author solves his problem by lowering the hardware acceleration level. Tested on Media Player 9, 10 and 11 with REG script to set appropriate settings.
http://thebackroomtech.com/2009/04/15/global-fix-windows-media-player-audio-works-video-does-not/
As well as applying this fix, you might check the affected machines have the latest drivers and codec versions. Finally, if possible, you may consider re-coding the content to a format that doesn't produce the display problems (if the bug is codec related.)
Using hardware acceleration is certainly more energy-efficient - according to this Intel report, almost twice as much energy is used without acceleration, and as there are 800 machines, there's reason to seek out a green solution.