Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Is there a Way To refrence a true false statement (http://www.chiefdelphi.com/forums/showthread.php?t=81555)

Must Be Drama 30-01-2010 20:44

Is there a Way To refrence a true false statement
 
yeah is there a way?

DonRotolo 30-01-2010 20:52

Re: Is there a Way To refrence a true false statement
 
Do you mean the output of a T/F statement? That is, whether it ended up T or F? Or something else?

Must Be Drama 30-01-2010 20:57

Re: Is there a Way To refrence a true false statement
 
i didnt explain it well
since we have the basic.vi and teleop.vi
i want to route the motor invert from basic.vi into the teleop to use a case structure to invert the motor at a push of a button

Mark McLeod 30-01-2010 21:08

Re: Is there a Way To refrence a true false statement
 
I don't know of any "Basic.vi," but yes you can pass variables between vi's.
There are several different ways to do so.

Tell us a little bit about basic.vi first, like where is it and what are you doing in it.

Must Be Drama 30-01-2010 21:09

Re: Is there a Way To refrence a true false statement
 
i ment begin sorry about that;

Mark McLeod 30-01-2010 21:30

Re: Is there a Way To refrence a true false statement
 
You know, I know another team that wants to do something like that too.
Planning to Close and Reopen your 2 or 4 motor drive?

You can simplify that particular problem, since Begin.vi is only ever called one time and the starting values of Invert are hardcoded. You already know in Teleop.vi what values would be passed in. It's much easier to just keep that information local to teleop.vi.

You can pass the value of your Invert to teleop.vi with a global variable if you so choose. Your team probably used global variables last year.

Must Be Drama 30-01-2010 21:38

Re: Is there a Way To refrence a true false statement
 
we didnt use global variables last year, i dont understand how to use them

Mark McLeod 30-01-2010 22:29

Re: Is there a Way To refrence a true false statement
 
This is in LabVIEW Help, but it's a bit hard to find.
  • Open the Begin.vi block diagram
  • Right-click for the Functions palette and go to Programming -> Structures and you'll see "GLOB" (for global variable) down at the bottom. Add that to your Begin.vi
  • Double click on the Global and you'll get a blank front panel.
  • Right-click on the Global front panel and add two boolean controls (doesn't matter which ones) to the global front panel. Rename them "Left Motor Invert" and "Right Motor Invert" or whatever you want to call them.
  • Save and close that global front panel. You'll be asked to give it a name, pick whatever you like, but be creative. I hate boring names.
  • Back in the Begin.vi block diagram right-click on that global you added before (it'll look like a globe), and choose Select Item -> Left Motor Invert.
  • Now copy and paste that global and right-click Select Item -> Right Motor Invert on that new one.
  • Wire both of those to you-know-where. Those values you wanted to send to Teleop.vi.
  • Save it and you now have global variables you can use anywhere.
Meanwhile, over in teleop.vi...
  • Highlight the two global variables you just made in Begin.vi and copy them.
  • Open the Teleop.vi block diagram and paste the global variables in.
  • Right-click on each of them and select "Change To Read" and now you can drag a wire from it to your case statement.
  • You can make more copies wherever you want to write back to them.

Brandon_L 30-01-2010 22:32

Re: Is there a Way To refrence a true false statement
 
A little off topic, but it reminded me:

Do you HAVE to close whatever it is in the end vi? I forgot to and didn't notice a difference.

Mark McLeod 30-01-2010 22:34

Re: Is there a Way To refrence a true false statement
 
1 Attachment(s)
That is bizarrely off-topic...
Did you just pick the uppermost thread on the portal to ask your question?

If you fail to close things they will come back to haunt you after the season...

Alan Anderson 30-01-2010 23:56

Re: Is there a Way To refrence a true false statement
 
It might be easier for you to add a case block to either multiply your motor control value by -1 or leave it alone, based on your pushbutton.

Must Be Drama 31-01-2010 11:05

Re: Is there a Way To refrence a true false statement
 
thanks alot imma try it when i reach today; i was searching in the help but it only gave me a small description how to do it

Danielle 01-02-2010 10:29

Re: Is there a Way To refrence a true false statement
 
You could use a joystick button and wire it directly to the open motor invert terminal.

1) Unbundle the buttons (brown 'out' terminal) on the JoystickGet.vi [this can be done by right clicking on the terminal, most things in LabView can, I've found new love for my right mouse button :) ]

2) Wire the desired button to the invert terminal on the OpenMotor.vi (2 motors or 4, it doesn't matter)

Danielle 01-02-2010 10:30

Re: Is there a Way To refrence a true false statement
 
BTW; I'm picturing this code in the Begin.vi

Mark McLeod 01-02-2010 10:56

Re: Is there a Way To refrence a true false statement
 
That solution won't work in this case.
The Begin.vi happens only once when the robot is first turned on, and they want to change the value on-the-fly during the match.

Tom Line 02-02-2010 01:08

Re: Is there a Way To refrence a true false statement
 
The easiest way to invert your motors response is simply to invert the value you are sending from the joystick.

In this case, inside the teleop VI get a button from the joystick and wire it to a true/false structure. In the false case, wire your normal joystick output through to your motor. In the true case, place a "negate" inside it, and wire your joystick through that.

Now all your joystick values that come out when the button is pressed and held will be inverted, and your motor will run "backwards" in response to them.


All times are GMT -5. The time now is 22:38.

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