-
Notifications
You must be signed in to change notification settings - Fork 5
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
While restarting multiple times device may stop streaming #2
Comments
Has there been any update on this bug? |
Hi @Pyrojambo, Yes, the problem exists. I will look into it but I can't promise when. The problem can be one of (in decreasing probability):
Checking 1 and 2 is actually rather easy:
If device is still sending data it is the library problem, otherwise it is likely vmu firmware/hardware who is the villain. In later case we have to contact Variense. It is one hour experiment, an hour I don't have currently ;-) But I will look into it (no promises when). |
Hi! I am also using - well trying to use - the VMU931 device but the problem you describe is making the thing almost useless in my case. I made a simple driver with an integrated test that demonstrates the problem nicely here: https://github.com/frugaltech/VMU931Driver It seems to me the problem has to be in the firmware somwhere. I initially used PyVMU to test out the device and I thought the problems arose from that package, since there were a few things that seemed a little off to me in that driver. But - as it turns out, my driver (and yours) have the save issues. Pyserial is definitely not to blame - I use that all over the place with no problems at all ever. The OS is not the problem either - I have tried both Ubuntu, Raspian and Windows with the same results. What are your thoughts on this? Have you had any luck contacting Variense support? I haven't had any response from them yet, unfortunately. |
Hi @frugaltech,
Looks ok at first sight and generally should work. Some minor quirks of vmu931 that I noticed:
You might have a problem if vmu ignored the stream Euler command. But since vmu streams Euler by default this would not happen in your code. If vmu ignored toggle quaternion you might get repeatedly serial connect/disconnect in
If I understand correctly, we have 3 independent implementations that suffer from the same problem:
Did you experience the same problem in PyVMU? Do I understand correctly?
Adding mine to the list:
I agree. Now, that we have:
It seems very likely.
I contacted Variense support on different issue (calibration and drift) and got response in the past (with undocumented magnetometer calibration procedure). Yes, we need to contact Variense. |
Thanks for the reply - it's nice to play some ball with these issues. Wrt. the PyVMU driver, then yes: I had the same issues with that implementation. Also, the device does not seem to ignore commands I send to it. If I configure it to only stream gyro data, it does so and I can reliably capture data - until I can't. I also tried the other streaming modes and while I sometimes get spurious packets that don't match the configuration; that behaviour does not seem to cause too much trouble. The lock ups I see apparently happen spontaneously in the get_message function in my driver. I just wrote the support team at Variense pointing them to my driver so I guess we'll see... |
Hi again! I also made a different driver using the USB CDC stuff directly rather than via the emulated serial port. It is available here: CDC driver - but ultimately, it makes no difference. The problems are the same. I did manage to get a response from Variense which was this: Hi Lars,We have received your support inquiry about the sensor VMU931. We have used internally only our C API under windows and Linux and we haven't faced any issues like the ones you noted in your email. Have you tried the VMU utilities or the VMUReader to test if the issue is with your Python script? According to your description of the problem, it's may be the buffer which is getting overloaded. Please don't hesitate to contact me if you need further information. Best Regards, Variense, Inc I haven't had a chance to pursue this further but I will at some point (soonish). In the meantime, I have found a new device that works without any hiccups - Yocto 3D v2 |
I contacted Variense about this again recently and they said it might be OS input buffer overflow, and suggested clearing the buffer after every read command. |
Hi @frugaltech, @Pyrojambo,
Interesting. I don't think it should "hang" the device but if you say that it helps it's worth trying, at least for the sake of investigation. Clearing the buffer after every read means that one may miss some packets from the device. Also if buffer overflow would be causing trouble, it should be reproducible - just leave the device streaming data. |
Huh, I also thought so but no time so far.
Thanks for the info. I like the idea that you may separate magnetometer from accelerometer and gyroscope. I have some trouble in my projects to find the right place for IMU. Accelerometer should be near the expected center of rotation to minimize rotational acceleration misinterpreted as linear acceleration. This usually means middle of the device between engines and near high current wires. Magnetometer should be away from engines, high current wires, etc. I am using Ultimate Sensor Fusion Solution. It is I2C, not USB communication, rather for integration with microcontroller. One may precisely timestamp the readings on interrupt. Another thing I am considering is dropping magnetometer completely. This means drift over longer period of time but no noisy magnetometer readings over short period of time. |
Hi Guys, I'm the guy that wrote PyVMU -- Interesting to read of your experiences with the VMU931 and reliability issues. Also cool to see your Python implementation @frugaltech, I hadn't considered this approach. It's a shame that it doesn't help things :( Was just wondering if either of you had had any further success with the VMU931, or have received any further information from Variense. Specifically, whether there's any kind of internal buffering on the device itself -- my current project needs the freshest possible data, so I flush input buffers in PySerial before reading the device. This often works, but is not reliable and still returns delayed data ~50% of the time. Cheers, |
Hi @JosephRedfern,
Not in my case, but I haven't contacted Variense on this issue.
I generally experienced some kind of lag sometimes but of different character. Something like a break and large number of buffered data. But I didn't/don't attribute it to VMU931, this was part of larger stack of software. Maybe, who knows. What order of buffering do you mean (e.g. in ms, if you can assess). In general USB bandwidth is managed by the host (your PC). The transmission is made when the host allows, typically this happens at 1000 Hz (each 1 ms). There is additional delay between the data arriving and your process being awaken. What OS are you on? So typically this means:
If you are streaming quaternions/euler, you will get data at 200 Hz (each 5 ms). Some ideasPacket by packet readingTaking a look at PyVMU You are reading on packet by packet basis Now if 1 + time_to_awake_your_process + your_packet_processing_time > 5 ms this will already buffer some packet from VMU on host side. Possible solution: instead of reading packet by packet grab as much data as there is and parse through it to the last packet. Other USB devicesIf you have other USB devices transferring at the same time they may have higher priority (like isochronous and input devices) low_latencyIf you are on Linux you may try your luck with setting low_latency flag on your device Just some ideas. Kind regards |
Hi @bmegli, Thanks for your prompt and detailed response.
This may well be the case here.
I'm capturing Data from two devices -- the ZED Mini (specifically, it's IMU) and the Variense VMU931. The ZED Mini IMU has a sample rate of 800Hz, and you can read from it asynchronously (i.e. if you sample at >800Hz you just get duplicate packets). My experimental setup is as follows: place ZED and VMU931 on the same surface. Wait for new packet (with a fresh timestamp) from the ZED, then immediately flush buffer and retrieve accelerometer packet from VMU931. I then log each packet. So over 2 seconds, at 800Hz, I get 1600 packets from each device. While the data is recording, I whack the table to generate an impulse. I'm then using convolution to figure out the offset between each signal. Sometimes (like above), there is minimal delay/lag between the two readings. Other times (again, as above) there is a delay. I flush the serial buffer before every read, but the delay seems to be either 0 or 1 packets, or 40-50 packets -- over ~30 runs of this experiment, I've not seen anything in the middle. 40-50 packets corresponds to ~50-60ms delay. I've also repeated this, plotting timestamp on X axis rather than packet number -- but the same thing is observed, which is particularly curious... I use the arrival time of the first packet as the epoch (for each respective device), so perhaps an incorrect offset could be introduced there?
I've observed this under Debian Unstable (my main OS) and Ubuntu 18.04.
0 to 1ms delay would be totally absolutely acceptable.
This could be it....
I'm only streaming Accelerometer packets, so this should be 1000Hz.
Yes -- but it seems strange that there is 0-1 packet delay ~50% of the time, and a 40-50 packet delay the other 50% of the time. It doesn't seem consistent!
Thanks again for the help. Joe |
Some more random thoughs
I think that ensuring that they are on different USB controllers should help. The priority is decided by USB device class. The higher priorities are for example:
I have no idea what class is VMU, this could be checked with E.g. lsusb # note the bus and device number
lsusb -s bus:device_number -v #v for verbose Look for Transfer Type (Interrupt, Bulk, Isochronous, ....) |
After talking to embedded Linux expert in my company the time to wake your process sleeping on IO may be reduced nearly to 0 if you have preemptive kernel and high priority process Before diving into that I would just check how much time the process spends sleeping. If the sleep time exceeds occasionally 1000 ms/800 Hz this may already buffer some packet on the host side. Another thing is that I have no idea how to explain 40-50 packet delay. |
Hi guys. I haven't really made any real progress using the Variense device. I really liked it because of the very nice finish and its features but practically speaking, it has not really been worth it. I am now using Yoctopuce devices instead - they are absolutely issue free, very precise and almost delay-free. I might do a C/C++ test to see if that helps somehow. That could then be the start of a Python integration point, but I am not very optimistic that it will work, so ... Lars |
Occasionally it's not possible to initialize communication with the device and only plugging/unplugging helps.
This generally happens when restarting communication with the device multiple times.
Cause to be investigated.
The text was updated successfully, but these errors were encountered: