Go to Post If you have a problem with a team, go to that team and address it with them. Don't air your slanderous opinions here for all to see. - Andy Baker [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-01-2009, 16:16
Nimrod Beker Nimrod Beker is offline
Thunder-Bolts Porgramming Team
FRC #2630 (Thunder-Bolts)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Israel
Posts: 7
Nimrod Beker is an unknown quantity at this point
Exclamation More than boolean Case Structure...

Hello team, iv'e noticed that i can or even need to use the case structure feature in more powerful way than true or false..
my need, is to use different kind of buttons to enter different kind of cases, since that every button return true\false value,im looing for way to navigate different taping to different cases,
Every help will warmly blessed
Nimrod Beker, Thunder-Bolts.
Reply With Quote
  #2   Spotlight this post!  
Unread 12-01-2009, 16:34
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,587
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: More than boolean Case Structure...

If your cases can be more easily separated into a bunch of numbers (Case 1, Case 2, Case 99) just create an enum or ring control with all of your cases listed in it and use that instead of a bunch of buttons.

If you're set on using a bunch of buttons to create a sort of binary tree, (Red/Blue Alliance, Turn Left/Right, etc.), then you could put all of your button outputs into a boolean array and use the "convert boolean array to number" function to get the integer equivalent of the binary number represented by your button states. You'd have to keep track yourself of which state number means what, however.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #3   Spotlight this post!  
Unread 13-01-2009, 06:06
Nimrod Beker Nimrod Beker is offline
Thunder-Bolts Porgramming Team
FRC #2630 (Thunder-Bolts)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Israel
Posts: 7
Nimrod Beker is an unknown quantity at this point
Re: More than boolean Case Structure...

Well first of all, great thanks kevin for trying to help.
I didnt really understood what should i do..
your idea sound very well, but one problem, buttons are boolean (by the way i could not find the "boolean array" over labview, so please, if you can to write where it is ) and as they are boolean, they're value will equal, so it will not be able to recognize which button pressed, plz correct me if i made a mistake..
i need a thing that some-how know to work like if\else in C's different languages.
something that work like this
"button 1 has been press so ill enter case 5. now button 3 and 7 pressed together, this would enter to case 4"
ill hope my little example will help you to help me better
Great thanks for you kevin and for every one that can help me to solve my desire lol
Nimrod Beker, Programming Team, Thunder-Bolts.
Reply With Quote
  #4   Spotlight this post!  
Unread 13-01-2009, 09:28
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: More than boolean Case Structure...

There are a couple ways of transitioning from a set of Booleans to logic decisions.

First, you can nest lots and lots of cases. LV doesn't have if/elses, but a Boolean case is pretty similar. Honestly, this is the hardest to read or modify, but it is an option.

Second, you can make an array of Booleans. Because the buttons are initially returned in a cluster, you can easily convert them to an array. Go either the array of cluster palette on the diagram, and there will be a bullet shaped node with [] and a vertical set of boxes.

If you only care about one button, many people will simply search the array for True, then switch on the numeric index returned from search. -1 means no bottons, 0 means at least first button pressed, etc.

If you care about combinations, most people will convert this array of Booleans to a number. It is in the Numeric>>Conversion palette. This will give you a 12 bit number storing all 4096 combinations. You can switch from the number and start filling in cases. You can add a new case diagram for some new code. You can then change the numbers that will activate that case by clicking on the text and typing into it. To run on multiple buttons, use either .. or ,s, for example [1, 4, 8] lists three independent numbers, [0..1024] is the short way of doing all numbers in between and including, and you can mix them too such as [0, 4..8]. Unfortunately, you cannot display the case in hex, so you will be doing the math conversions in your head, no problem right?

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 13-01-2009, 09:42
Shivang1923 Shivang1923 is offline
I make robot go VROOM VROOM!
FRC #1923 (MidKnight Inventors)
Team Role: Programmer
 
Join Date: Feb 2008
Rookie Year: 2008
Location: West Windsor, NJ
Posts: 38
Shivang1923 has a spectacular aura aboutShivang1923 has a spectacular aura about
Re: More than boolean Case Structure...

I think I can explain it...if not then this is how I did it


There is a box in LabView that is called Joystick.Get. From there wire a "unbundle by name" to the button output. Then from there make the unbundle by name box the right size (i.e. shows 3 buttons if you want 3 of them) and then click each one and select the button you want from the dropdown menu. Make a Boolean to array box, and wire each button into a separate input (resize as needed). Then wire the output of that into a case statement.


now the boolean to array converts trues and falses into binary numbers.

example
....................______
Button 1------|........| CASE STRUCTURE
Button 5------|........|------[?]
Button 3------|_____|


if button one is pressed, then the output of the boolean to array will be 1
if button 5 is pressed then 2
if button 3 then 4
if one AND five then 3
etc.

So you have a 0, Default (should be made automatically) for nothing pressed or for some value that isnt specified...(in example if 5 and 3 pressed or 1 and 3 pressed)

and then the rest of them you stick in the number you want. so

CASE STRUCTURE
<|0,Default|>
<|1 |> button 1 pressed
<|2 |> button 5 pressed
<|3 |> button 1 and 5 pressed
<|4 |> button 3 pressed


note: all button numbers represent those on the joysticks included in the kit...trigger being button 1

if I have misnamed anything, I am sorry cause im in school right now and I dont have labview open to check the names.
Reply With Quote
  #6   Spotlight this post!  
Unread 13-01-2009, 15:41
Nimrod Beker Nimrod Beker is offline
Thunder-Bolts Porgramming Team
FRC #2630 (Thunder-Bolts)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Israel
Posts: 7
Nimrod Beker is an unknown quantity at this point
Re: More than boolean Case Structure...

Wow thanks, if think that what ive looking for ..
ill try it later in the robot class..
i think this would solve it but keep generate ideas
Reply With Quote
  #7   Spotlight this post!  
Unread 14-01-2009, 11:05
Chaos in a Can Chaos in a Can is offline
Joel Spadin
FRC #1736 (Robot Casserole)
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Peoria, IL
Posts: 58
Chaos in a Can is an unknown quantity at this point
Send a message via MSN to Chaos in a Can
Re: More than boolean Case Structure...

As Kevin suggested, you can also have a control with more than just on/off.

If you can set this up as a list of options rather than a number of buttons, create a ring or enum control and wire it to the case structure. Fill the control with all the possible cases, and you can create a case in the case structure for each choice in the enum/ring control.
__________________
2006 Xerox Creativity Award
2007 General Motors Industrial Design Award
2008 Judges' Award
2009 Chrysler Team Spirit Award

Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CRio more than nationals lenny8 FRC Control System 6 16-11-2008 12:33
More than One Regional? smurfgirl Regional Competitions 35 26-03-2008 14:21
More than 1 autonomos... Jimmy_Team7011 Programming 5 16-03-2008 15:33
more than 4 ir controls? Vanquish Programming 2 12-01-2008 14:52
Robowarriors: More visited than CD! Tim Arnold General Forum 11 26-10-2007 11:54


All times are GMT -5. The time now is 08:30.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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