LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

motor crashing labview

Solved!
Go to solution

Hi everyone,

 

I've got this VI and it takes serial data from a touchscreen and it goes through a PID controller to some motors using the myRIO. When the VI starts up, the motors will assume their original position and then LabVIEW will crash. I really need this help to fix this and get the VI to run smoothly.

 

Thanks so much,

 

James

Download All
0 Kudos
Message 1 of 19
(4,738 Views)

What's up with your 2014 VI? It's just an image on the block diagram with no actual code....

 

Are you seeing an all-out LabVIEW crash? Does the bug report tell you anything specific? The source VI that caused the crash?

 

Usually crashes occur when you're trying to access the same thing from two places at once. I see you have your Duty Cycle VIs in parallel for the parallel channels. Is it necessary to write at the same exact time? I can't see your subVI so I don't know what it does, but maybe you should use the error clusters for those subVI instances to make them operate one after the other. This might fix your problem.

 

 

Separate from the crash: Wire a stop button to your while loop stop terminal, not a True constant. You should be stopping your VI the right way especially when you're doing instrument communication.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 19
(4,726 Views)

Sorry, I guess I messed up saving the 2014 file. I'm not at school now but I'll upload a better version first thing when I get there tomorrow. 

 

It's a bit different, the program runs and then our touchscreen starts to behave almost as if it's sending too much data to the myRIO and our motors will lock up. We can terminate the program and restart it but the problem persists. If we exit LabVIEW we get a window about the program crashing. Otherwise it doesn't actually report and bugs. We actually had the program working just fine. We had the big while loop running continuously so I figured I ought to but the myRIO reset inside the while loop but that didn't work so we put it back outside the while loop and then we started getting problems. 

 

I'll try what you told me the error clusters tomorrow and same with the stop button and I'll write back.

 

Thank you,

 

James

0 Kudos
Message 3 of 19
(4,712 Views)
Oh! So not a crash. A lag.

I'm not at my computer anymore, but I don't think you had any loop timing, so it was looping as fast as it could. This can cause a user interface lag kinda like what you're seeing I bet. Add a delay to help that out by placing a Wait node with a value of something like 50ms.

Your architecture is polling the user inputs every loop and writing the values to the instrument every time. You can improve on this by puting a case structure around the instrument VIs and only write to the instrument when the user input values change.

You should also look in to a better architecture for your application if you plan on building on this. Google "LabVIEW State Machine" for a very simple scaleable arachitecture.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 19
(4,696 Views)

Hey, I really appreciate your help.

 

LabVIEW 2014 is behaving a bit strange. When I try to copy my block diagram from 2015 to 2014 it will only allow me to view the block diagram and not the front panel.

 

I update the VI to include a few things you mentioned. I added the case structure as well as the stop button. I notice when I run the VI that the touchscreen will read correctly and everything is generally well. But as soon as I select the PWM channel for each motor and then touch the touch screen, the VI locks up so I think the problem is with the PWM.

 

I was originally using a queue state machine with the producer and consumer loop. I modified it a little bit so that I could include graphs that would continuously update and not lose their place when the consumer while loop ended. Another reaosn why I modified the queue state machine was so that the PID controller could count the time properly without starting over when the consumer while loop ended each time. 

 

James

Download All
0 Kudos
Message 5 of 19
(4,660 Views)

Oh, I see now there's a problem with my PWM error cluster

0 Kudos
Message 6 of 19
(4,635 Views)

Negate the last message. I just made a silly mistake. Still not behaving correctly

0 Kudos
Message 7 of 19
(4,621 Views)

@JCG77 wrote:

Hey, I really appreciate your help.

 

LabVIEW 2014 is behaving a bit strange. When I try to copy my block diagram from 2015 to 2014 it will only allow me to view the block diagram and not the front panel.

 

...

 

James


You can't copy a block diagram from one version to another.

You can save your vi in a LabVIEW 2014 version in LabVIEW 2015 and then open that vi in your LabVIEW 2014.

0 Kudos
Message 8 of 19
(4,616 Views)

Thanks for the tip dkfire. I think I've got uploaded properly finally. Some of the subVIs are a UART read and some PWM  stuff for the myRIO.

 

I can got it to work one time but it's still too slow. Is there a speed the VI up?

 

0 Kudos
Message 9 of 19
(4,602 Views)

What exactly is too slow? You need to be a little more specific.

 

Is it looping too slow? Is it just the interface that is slow? You have the 50ms Wait already in there now. Is that too long for what you want?

 

What are you doing with all of your queue code? You obtain a queue, dequeue an element, and then release the queue. This does nothing for you as you are waiting for the while loop to finish anyways. Just output the first element from the While loop and get rid of all the queue code.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 10 of 19
(4,593 Views)