Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Button Checking Code lags Teleop.vi (http://www.chiefdelphi.com/forums/showthread.php?t=113302)

ILikePizza555 11-02-2013 22:03

Button Checking Code lags Teleop.vi
 
I have some code that I'm using to check button presses on a joystick. It looks like this:



For some reason this code keeps hanging the program, and it takes forever to send output to a motor. I verified this but wrapping it in a disabled diagram block. Any workarounds?

propionate 11-02-2013 23:16

Re: Button Checking Code lags Teleop.vi
 
I'm a little confused as to why you have contained your separate motor control VI's in a flat sequence. Are you attempting to run these controls in a particular order if a certain combination of buttons is pressed? If not, there is no need for the flat sequence structure.

Greg McKaskle 12-02-2013 07:11

Re: Button Checking Code lags Teleop.vi
 
I assume you placed that code into teleop. If teleop doesn't read the joysticks and update the robotDrive many times per second, it will act as you describe. Once your sequence starts, the delays prevent teleop from doing the robotDrive task.

What most teams do is to move the code you've shown into periodic tasks. That way teleop can run quickly and return to the scheduler.

Greg McKaskle

ILikePizza555 12-02-2013 20:03

Re: Button Checking Code lags Teleop.vi
 
Quote:

Originally Posted by propionate (Post 1231966)
I'm a little confused as to why you have contained your separate motor control VI's in a flat sequence. Are you attempting to run these controls in a particular order if a certain combination of buttons is pressed? If not, there is no need for the flat sequence structure.

I had the idea that it was running too many things at once, and that if I put it into a flat sequence structure, it will slow down a bit. That, and I'm more used to coded languages such as python or java, the flat sequence make a little bit more "sence" to me.

Quote:

Originally Posted by Greg McKaskle (Post 1232037)
I assume you placed that code into teleop. If teleop doesn't read the joysticks and update the robotDrive many times per second, it will act as you describe. Once your sequence starts, the delays prevent teleop from doing the robotDrive task.

What most teams do is to move the code you've shown into periodic tasks. That way teleop can run quickly and return to the scheduler.

Greg McKaskle

I'll try that tonight, thanks.

ILikePizza555 13-02-2013 01:03

Re: Button Checking Code lags Teleop.vi
 
Found out that it wasn't the button checking code, but the fact that SetOutput causes some sort of lag for some reason when it trys to set motor output on a jag that doesn't exist. Is this normal?

plnyyanks 13-02-2013 09:42

Re: Button Checking Code lags Teleop.vi
 
Quote:

Originally Posted by ILikePizza555 (Post 1232568)
Found out that it wasn't the button checking code, but the fact that SetOutput causes some sort of lag for some reason when it trys to set motor output on a jag that doesn't exist. Is this normal?

Yes, this will happen when you try and access a refnum that hasn't been previously opened. If you look on your Drive Station at the error messages, you'll see your program throwing an error of that nature. Your code will slow down noticeably when there are errors being thrown, as handling them takes processing power away from your main code.


All times are GMT -5. The time now is 12:10.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi