Go to Post if we aren't here for some wisdom...what are we here for? - Molten [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 14-03-2009, 13:40
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Programming toggle switches to DS for different autonomous routines?

We would like to use toggle switches on the DS to trigger different autonomous routines. Of course, we don't have the robot to test our code. We are attaching our best guess. Could someone look over our code to see if it would work. (We only have one routine programmed at this time.)
Attached Files
File Type: doc Autonomous VI.doc (79.0 KB, 68 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 14-03-2009, 17:34
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,861
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Programming toggle switches to DS for different autonomous routines?

A couple of problems...

First, the Driver Station switches cannot be read during Autonomous. For your purpose they must be read BEFORE autonomous begins and remembered for use here. How you do that depends on the Framework you started with (Basic or Advanced). There are CD threads on this topic you can checkout along with sample code.

Second, as written, all your drive commands will actually occur all at once. To sequence them you must tie the error output of each Delay & Feed to the next Tank Drive command you want to have happen.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 14-03-2009, 21:43
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: Programming toggle switches to DS for different autonomous routines?

for the switches

You could just place this in the "other", "default" case in the robotmain vi for basic framework
and for advanced framework in disable vi "execute" case

my code uses less switches, and converts them into a number, you can just modify it as you need.

as for the drive commands, i would say do as Mark said, but i dont think it should make a difference except for the crab drive sections, and that is because the device refrences force a chain, but to be safe you should chain the errors like mark said.
Attached Files
File Type: vi GetSwitch.vi (9.4 KB, 53 views)

Last edited by Shivang1923 : 14-03-2009 at 21:46.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-03-2009, 11:31
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Re: Programming toggle switches to DS for different autonomous routines?

We have the Get SwitchVI in place now in "other""default", thanks Shivang1923. How did I get the selected autonomous mode to be read in the autonomous VI. We have found a few CD threads on this topic, but they are written for the advanced mode. We are using Basic mode. Is this possible in Basic or are we not finding the right threads?

Thanks
Reply With Quote
  #5   Spotlight this post!  
Unread 15-03-2009, 17: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: Programming toggle switches to DS for different autonomous routines?

Quote:
Originally Posted by grosh View Post
We have the Get SwitchVI in place now in "other""default", thanks Shivang1923. How did I get the selected autonomous mode to be read in the autonomous VI. We have found a few CD threads on this topic, but they are written for the advanced mode. We are using Basic mode. Is this possible in Basic or are we not finding the right threads?

Thanks
ok try something along these lines

i am assuming you guys changed the vi to match your button inputs
the output of the GetSwitchVI is a number
the number is counted in binary depending on the switch: so if the first switch is true, then the number is 1, if the second then it is 2 if first AND second then 3 if none then 0.

there is a global variable called robot data. If you have watched the tipjar videos from lvmastery.com, you would know how to place more 'data(for lack of the proper term =P)' into the global variable Robot Data. place just a number indicator into there.

in autonomous independent vi, unbundle the global, take the number (again, the videos from lvmastery tipjar will teach you this.) and wire it into a case structure. Then inside each of the cases, put what autonomous code you want running into it.
Reply With Quote
  #6   Spotlight this post!  
Unread 15-03-2009, 19:05
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,753
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: Programming toggle switches to DS for different autonomous routines?

You could possibly get by with a cheap switch read when the cRIO first boots, but I think a better solution takes just a few edits of the Basic template.

On your Basic diagram, open the Basic Get Mode VI. On its panel is an output called Robot Mode which wasn't connected as an output. When the template was made, I never checked to see what the DS behavior was, and assumed that Other would work fine. Since it doesn't, here is how to fix it.

On the subVI, right click on the icon in the upper right of the Basic Get Mode panel and Show the Connector. Click on one of the connector outputs, then click on the Robot Mode. Save the VI, Close, and on the Basic Robot Main, you now have access to the Robot Mode output. Wire this to the edge of the case so that in Other you can switch on it and you can read the switches only in Auto Disabled and set a global with the state of the switches.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 15-03-2009, 22:51
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Re: Programming toggle switches to DS for different autonomous routines?

I added the connection to the other(Thanks Greg). We are using three separate switches to change between three different autonomous routines so from Shivang GetSwitch VI I changed the GetSwitch inputs to indicators. I then added the DriverStationDigInputs to the global. We unbundled the new switch global in autonmous. Make sense?

We won't get to test the code for a few weeks.

THANKS ALL! Without ChiefDelphi and LVMastery we could not have gotten our robot running.
Reply With Quote
  #8   Spotlight this post!  
Unread 16-03-2009, 07:34
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,753
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: Programming toggle switches to DS for different autonomous routines?

I'm not sure I followed where you are reading the DS inputs. The place I've shown others is inside the Other case, but then use the new input to further limit it to autoDisabled. Read and store in the global to read other places such as your Autonomous routine.

If that is what you have, then I think you have what you need.
Good Luck.
Greg McKaskle
Reply With Quote
  #9   Spotlight this post!  
Unread 16-03-2009, 09:05
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 747
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: Programming toggle switches to DS for different autonomous routines?

Another way to do this is to use the driver joystick buttons to set the auto mode, and display it on the DS LCD

I wrote a white paper on how to do this, and included a VI with the code.

I'm on an I- touch so I can't paste the URL, but if you go to CD media, and search for my white paper it's easy to find. Search for posts by Philbot with a keyword of Auto.

It doesn't need any wiring changes, and it remembers the mode through reset. The mode can be changed at any time during Auto Disabled
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
Reply With Quote
  #10   Spotlight this post!  
Unread 30-03-2009, 20:42
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Re: Programming toggle switches to DS for different autonomous routines?

If this helps, there is a dipswitch on the cRIO that is readily available for user use (a light too). If you only have two types of autonomous modes, you can use that switch to change modes before each match starts. In LabVIEW, the VIs for getting the switch state and controlling the light are in the driverstation palette, I think. Someplace like that, look around.

Here's a very helpful manual about the cRIO that mentions these things:
http://decibel.ni.com/content/docs/DOC-2632
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
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
Programming Toggle Switches in Labview seanl Programming 1 16-02-2009 13:02
Multiple programs/autonomous routines galewind Programming 12 09-01-2004 22:25
Autonomous Routines Powers Rules/Strategy 15 10-04-2003 10:27
3 way toggle switch programming LeadRiccardoT Programming 3 17-02-2003 02:02
Wiring custom toggle switches into operator interface DanL Electrical 9 13-02-2002 17:13


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

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