Go to Post In theory, there is no difference between theory and practice. In practice, however... - Alan Anderson [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 08-03-2014, 18:18
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Multi-Choice Autonomous

Hello! We've created seven (and counting!) different autonomous modes to account for the various situations we might end up being in and what we decide to do depending on the other alliance robots as well as the robots on the opposing alliance. We program in Labview, so what I would like to know is if we can put controls on the front panel (the grey page with gridlines) with a separate button for each of the seven autonomous modes so that we wouldn't have to run a different .lvproj each time we want to use a different version of autonomous. What I plan on doing is just clicking one of the seven buttons on the front panel right before each match to make it light up. The project reads which one of the seven buttons is true, making its corresponding case structure true (for the moment, I think that I'll be using case structures, but I'm open to any suggestions you may have). Basically, I know how this will be programmed, but my main question is if I am allowed to do this. I know that this may seem like a strange question to some people, but then again, I've seen stranger rules than this! Feel free to ask if any details of my questions seem foggy. Thanks enormously for any help or suggestions!
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #2   Spotlight this post!  
Unread 08-03-2014, 18:29
Kevin Phan's Avatar
Kevin Phan Kevin Phan is offline
College Student
FRC #0357 (Royal Assault)
Team Role: Alumni
 
Join Date: Apr 2013
Rookie Year: 2010
Location: PA, United States
Posts: 95
Kevin Phan will become famous soon enoughKevin Phan will become famous soon enough
Re: Multi-Choice Autonomous

This is legal, just make sure this is before they get to the alliance station. My team uses an on board switch, but I see this as perfectly legal as long it is before the auto starts.
Reply With Quote
  #3   Spotlight this post!  
Unread 08-03-2014, 18:29
AGPapa's Avatar
AGPapa AGPapa is offline
Registered User
AKA: Antonio Papa
FRC #5895
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Robbinsville, NJ
Posts: 323
AGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond repute
Re: Multi-Choice Autonomous

There are no rules prohibiting this. However, I don't understand how you plan on doing it. Do you want these controls on the front panel of autonomous.vi? How are you going to edit those controls once the code is compiled? Or do you plan on recompiling your code whenever you want to change the autonomous routine?

A simpler way that doesn't require you to recompile code is to use the digital inputs on the driver station. The default autonomous.vi already has code to read from the driver station's digital inputs. Just click on a different button before each match to select which auto mode you want to use,
Attached Thumbnails
Click image for larger version

Name:	digital inputs.JPG
Views:	47
Size:	73.3 KB
ID:	16507  Click image for larger version

Name:	autonmous.JPG
Views:	67
Size:	62.4 KB
ID:	16508  
__________________
Team 2590 Student [2011-2014]
Team 5684 Mentor [2015]
Team 5895 Mentor [2016-]
Reply With Quote
  #4   Spotlight this post!  
Unread 08-03-2014, 18:31
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Multi-Choice Autonomous

Quote:
Originally Posted by Kevin Phan View Post
This is legal, just make sure this is before they get to the alliance station. My team uses an on board switch, but I see this as perfectly legal as long it is before the auto starts.
I see ... thanks!
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #5   Spotlight this post!  
Unread 08-03-2014, 18:36
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Multi-Choice Autonomous

Quote:
Originally Posted by AGPapa View Post
There are no rules prohibiting this. However, I don't understand how you plan on doing it. Do you want these controls on the front panel of autonomous.vi? How are you going to edit those controls once the code is compiled? Or do you plan on recompiling your code whenever you want to change the autonomous routine?

A simpler way that doesn't require you to recompile code is to use the digital inputs on the driver station. The default autonomous.vi already has code to read from the driver station's digital inputs. Just click on a different button before each match to select which auto mode you want to use,
I understand ... but if I use the digital inputs, what kind of structure do I connect each input to? I would be led to believe I would use a case structure, but I could be wrong.
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #6   Spotlight this post!  
Unread 08-03-2014, 18:58
Kevin Phan's Avatar
Kevin Phan Kevin Phan is offline
College Student
FRC #0357 (Royal Assault)
Team Role: Alumni
 
Join Date: Apr 2013
Rookie Year: 2010
Location: PA, United States
Posts: 95
Kevin Phan will become famous soon enoughKevin Phan will become famous soon enough
Re: Multi-Choice Autonomous

Yes you would use a case structure. What you can do is create a boolean array and convert it to numeric and wire that to the case structure.
Reply With Quote
  #7   Spotlight this post!  
Unread 08-03-2014, 18:59
AGPapa's Avatar
AGPapa AGPapa is offline
Registered User
AKA: Antonio Papa
FRC #5895
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Robbinsville, NJ
Posts: 323
AGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond reputeAGPapa has a reputation beyond repute
Re: Multi-Choice Autonomous

Quote:
Originally Posted by alexander.h View Post
I understand ... but if I use the digital inputs, what kind of structure do I connect each input to? I would be led to believe I would use a case structure, but I could be wrong.
The default code I showed before takes the array of booleans and splits it up into individual booleans. You can treat the outputs of the index array the same way you would treat the 8 individual button on the front panel.

Having separate case structures for each button and each autonomous mode would work, the first image I've attached shows how to do this.

This code will work fine if only one button is pressed at a time. If two or more buttons are pressed then each autonomous mode will run together at the same time. This is generally bad.


So for each case structure you should make sure that a certain button is pressed and all others aren't. There's a clever way to do this using "boolean array to number". This will turn the boolean array into an integer by treating the array like a boolean number. For example (four buttons):
0000=0
0001=1
0010=2
0100=4
1000=8
(Each button is represented by one digit)
Your cases for each mode will then be 1, 2, 4, 8, 16, etc.
Now if two buttons are pressed (ex: 0011=3) then it will enter the default case and not do anything!

Either approach will work, the second one will just make it impossible to execute two autonomous modes at the same time.
Attached Thumbnails
Click image for larger version

Name:	parallel case structures.JPG
Views:	55
Size:	125.9 KB
ID:	16509  Click image for larger version

Name:	booleanArrayToNumber.JPG
Views:	41
Size:	86.5 KB
ID:	16510  
__________________
Team 2590 Student [2011-2014]
Team 5684 Mentor [2015]
Team 5895 Mentor [2016-]
Reply With Quote
  #8   Spotlight this post!  
Unread 08-03-2014, 19:00
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Multi-Choice Autonomous

Quote:
Originally Posted by Kevin Phan View Post
Yes you would use a case structure. What you can do is create a boolean array and convert it to numeric and wire that to the case structure.
Is this what I can do or what I must do?
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #9   Spotlight this post!  
Unread 08-03-2014, 19:02
Kevin Phan's Avatar
Kevin Phan Kevin Phan is offline
College Student
FRC #0357 (Royal Assault)
Team Role: Alumni
 
Join Date: Apr 2013
Rookie Year: 2010
Location: PA, United States
Posts: 95
Kevin Phan will become famous soon enoughKevin Phan will become famous soon enough
Re: Multi-Choice Autonomous

You're going to have to.
Reply With Quote
  #10   Spotlight this post!  
Unread 08-03-2014, 19:03
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Multi-Choice Autonomous

Quote:
Originally Posted by Kevin Phan View Post
You're going to have to.
If you take a look above, AGPapa shows a way where I don't have to.
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #11   Spotlight this post!  
Unread 08-03-2014, 19:17
Kevin Phan's Avatar
Kevin Phan Kevin Phan is offline
College Student
FRC #0357 (Royal Assault)
Team Role: Alumni
 
Join Date: Apr 2013
Rookie Year: 2010
Location: PA, United States
Posts: 95
Kevin Phan will become famous soon enoughKevin Phan will become famous soon enough
Re: Multi-Choice Autonomous

For me it is cleaner to use the boolean array conversion, instead having multiple case structures. AGPapa's examples are still valid. It's up to you to what you want to use.
Reply With Quote
  #12   Spotlight this post!  
Unread 08-03-2014, 19:25
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Multi-Choice Autonomous

Quote:
Originally Posted by Kevin Phan View Post
For me it is cleaner to use the boolean array conversion, instead having multiple case structures. AGPapa's examples are still valid. It's up to you to what you want to use.
OK, thanks!
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #13   Spotlight this post!  
Unread 09-03-2014, 07:51
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,752
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: Multi-Choice Autonomous

You can use the Boolean bits however you like. Note that you can also name the switches on the DS so that the drive team knows what they are selecting. Just click on the field and give them a short name.

In the auto, you may want to account for unusual settings, illegal values, etc. In those cases, be sure to run something.

A few things you may want to consider.

Searching for the first True Boolean in the array gives you eight valid values (0 - 7) with good labels on the DS.

Converting the Boolean array to a number is in the Numeric>>Conversion palette and it gives you 256 valid values (0-255). The encoding will be in binary and the DS will not read as well.

You can use the sliders too, so if some of your programs vary only be a speed or a steering angle, you may want to use a slider instead. They can also be named on the DS.

Greg McKaskle
Reply With Quote
  #14   Spotlight this post!  
Unread 09-03-2014, 07:55
alexander.h's Avatar
alexander.h alexander.h is offline
Lead Programmer, Captain, Driver
FRC #3975 (The Dragons)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Montreal, Quebec, Canada
Posts: 261
alexander.h has a spectacular aura aboutalexander.h has a spectacular aura aboutalexander.h has a spectacular aura about
Re: Multi-Choice Autonomous

Quote:
Originally Posted by Greg McKaskle View Post
You can use the Boolean bits however you like. Note that you can also name the switches on the DS so that the drive team knows what they are selecting. Just click on the field and give them a short name.

In the auto, you may want to account for unusual settings, illegal values, etc. In those cases, be sure to run something.

A few things you may want to consider.

Searching for the first True Boolean in the array gives you eight valid values (0 - 7) with good labels on the DS.

Converting the Boolean array to a number is in the Numeric>>Conversion palette and it gives you 256 valid values (0-255). The encoding will be in binary and the DS will not read as well.

You can use the sliders too, so if some of your programs vary only be a speed or a steering angle, you may want to use a slider instead. They can also be named on the DS.

Greg McKaskle
I see, but where exactly do I edit the names of each digital input? Directly on the driver station?
__________________



2012 - Rebound Rumble - Montreal Robotics Festival - Qualified 15th - Semifinalists thanks to 3379 and 3710 (Record : 8-8-1)
2013 - Ultimate Ascent - Montreal Robotics Festival - Qualified 33rd - Dean's List Finalist : Yazid Djenadi (Record : 4-8-0)
2014 - Aerial Assist - Montreal Robotics Festival - Qualified 9th (Record : 6-4-1)
2015 - Recycle Rush *** I predicted the game ***

Reply With Quote
  #15   Spotlight this post!  
Unread 09-03-2014, 08:07
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,752
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: Multi-Choice Autonomous

Yes, each button has a text field to the right of it. It should store and retrieve those when you next launch the DS. They are stored in the ini file. The names are not sent to the robot, only the Boolean values.

Greg McKaskle
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


All times are GMT -5. The time now is 20:15.

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