Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Webcam slowing down my VI on myRIO massively

Okay so I am doing my first proper labVIEW project on the myRIO. I have 2 while loops, 1 collecting and controlling motor data and displaying the accelerometer on a graph, the other collecting camera data and displaying it.

 

If I do remove the camera while loop the accelerometer loop runs smoothly and really quickly. As soon as I add the parallel camera loop the accelerometer graph updates so slowly also the camera displays photos really slowly too. I've tried adding them in the same while loop and I get the same outcome.

 

What I want to know is, am I taxing the myRIO by having a camera (640x320 resolution) streaming and that is why the vi is updating super slowly or is it the way I have programmed the loops maybe they are blocking each other?

 

I hope it can stream webcam data and control the motors at the same time or I can't use it.

 

Ive attached an image of my vi, if you scroll to the bottom you can see the webcam loop, ive also included a zip of the project. Hopefully someone can point me where I am going wrong.

 

 

Download All
0 Kudos
Message 1 of 4
(6,411 Views)

Hi Funcooker, 

 

Thanks for the attached files. Have you tried a simple VI just to take the images? Does that run okay? 

 

To me it looks like you're overworking the myRIO a bit. You're capturing image data every 15ms which is quite a fast frame rate. What happens if you increase the waittime in your camera loop? Is there any improvement? 

 

If this is the problem it may be a better idea to use the low level VIs for data aquisition such as IMAQ instead of the express VIs - they're quite a bit more memory intensive. 

 

Please let me know if slowing the speed of capture helps at all. 


Thanks, 

Charlotte N. 

0 Kudos
Message 2 of 4
(6,373 Views)

Hi Charlotte

 

Thanks for your help, slowing down the time does help, I set it to 70ms and that made things run a bit smoother. The accelerometer graph is still slow though compared to when the camera isn't being used. I would rather sacrifice the frame rate of the camera entirely to just have a smooth display of the accelerometer graph but it seems increasing the framerate doesn't ever make it run like it used to.

 

I would be happy with 5fps if I could just get a speedy graph again. Maybe it's the way I have programmed it.

0 Kudos
Message 3 of 4
(6,346 Views)

Hi Funcooker, 

 

The fact that it does run a bit smoother when you slow the frame rate implies to me that it is a memory issue with the myRIO. What happens if you take an image every 5 seconds for example? Does the accelerometer run smoothly then? If it does then at least we definitely know the cause. Then it's a matter of making your code less intensive. 

 

If you're okay with 5fps how smoothly does everything run with a delay of 200ms?

 

 

I can't see anything wrong with the way that you have programmed your code. There does not appear to be anything that would be causing the accelerometer graph to slow based on the camera other than memory usage. But there are ways we could make it more streamlined. 

 

 

Do you have access to the IMAQ drivers? It may be better to use those as they are much less memory intensive than the Vision Acquisition Express VI. I've included an example below for how to go about coding image capture using the IMAQ drivers. Perhaps see if you can implement this instead of the Express VI and see if that makes a difference? 

 

IMAQ Camera Capture.PNG

 

Basically the Express VI does all four of these steps every time it exectues. When really you only want the step within the loop to execute multiple times. By coding it like this you can remove un-needed steps occurring. 

 

Thanks, 

Charlotte N

 

0 Kudos
Message 4 of 4
(6,331 Views)