04-18-2012 05:37 AM
Heya, I'm new to LabVIEW and I've been working on a control system for a cube-shaped underwater remotely operated vehicle. The programme was great until I put the DAQ assist in and now it runs very slowly. Does anyone have any ideas on how to speed it up?
Basically it takes the input from an xbox controller (Dpad, left and right triggers and A button) and uses the Dpad for direction (digital output to 4 motor, 1 placed on each corner, two forward facing and two backward facing) the triggers increase and decrease the speed which is an analouge output voltage between 2 and 5 (5 is slow speed, 2 is high speed) and the A button switches lights on and off.
At the same time a user input is compared to an analogue input from a pressure sensor to control depth. Based on the difference of these values, a bilge pump is run and/or a valve is opened/closed.
All in all, I've got 1 analogue input from the pressure sensor, 2 analogue outputs (the speed of the motors and the bilge pump) and 7 digital outputs (4 for the motors, 1 for the bilge pump, 1 for the valve and 1 for the lights).
If anyone has any ideas on how to make it run more quickly that would be fantastic, it's for a group project due in at the end of April so I'm a little panicked.
Many thanks
04-18-2012 08:44 AM
First of all, you might consider how to encompass logical parts of your vi into subvi's. Your block diagram wouldn't fit on my 20" monitor.
It looks to me like you could reduce the number of samples that you are acquiring. For example, you have a Analog 1D waveform output for N channels on the lower left part of the diagram. You are then converting an array of waveforms to dynamic then to a scalar. If you just need on data point, then just acquire one point on one channel.
04-18-2012 10:18 AM
Here is a clean version to start with. I did not change anything in the execution
But you will see that it is much easier to follow this way. I also noticed that you have a timeout in your loop of .3 seconds when a certain condition is met. You need to change the way this works so that your loop does not get stuck waiting on the timeout.
other than a few things that should not make a difference.