Go to Post I don't think FIRST is the reason for following rules, being respectful, etc. We should do that anyway. - Dan Zollman [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 04-02-2014, 06:29 PM
trevormcclellan's Avatar
trevormcclellan trevormcclellan is offline
Registered User
FRC #5137 (Iron Kodiaks)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: San Marcos, California
Posts: 2
trevormcclellan is an unknown quantity at this point
Autonomous Switching With the Iterative Robot Template

Hello everyone, I am a programmer from team 5137 and I was wondering if there was a simple way to choose an autonomous program from the smart dash board like the tutorial, but with the iterative robot template instead of command based.
Here is the tutorial: http://wpilib.screenstepslive.com/s/...smartdashboard
Reply With Quote
  #2   Spotlight this post!  
Unread 04-02-2014, 07:12 PM
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: Autonomous Switching With the Iterative Robot Template

The approach my team uses for multiple autonomous modes is to choose a mode based on one of the analog input sliders on the driver station (see attachment). Each autonomous mode is encapsulated within a class that inherits from the AutonomousMode base class. In autonomousInit(), we read the value of the first analog slider and then use that number in a switch statement to choose which autonomous class to create an instance of. Here's last year's code if you're interested (autonomous modes are in the "org.lunatecs316.frc2013.auto" package). The downside to this approach is that you have to remember the numbering of your autonomous modes.
Attached Thumbnails
Click image for larger version

Name:	dsio.png
Views:	38
Size:	59.6 KB
ID:	16757  
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)

Reply With Quote
  #3   Spotlight this post!  
Unread 04-02-2014, 08:34 PM
TFleig78's Avatar
TFleig78 TFleig78 is offline
Registered User
AKA: Tyler
FRC #0078 (Air Strike)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Rhode Island
Posts: 58
TFleig78 will become famous soon enoughTFleig78 will become famous soon enough
Re: Autonomous Switching With the Iterative Robot Template

You could do a similar thing as shown in the post above, but with Smartdashboard.

If you write:

Code:
SmartDashboard.putNumber("exampleVal", value);
You can edit the value before the match, depending on the auto you want then write the following to get the value and use it to run a specific sequence.

Code:
SmartDashboard.getNumber("exampleVal");
Reply With Quote
  #4   Spotlight this post!  
Unread 04-02-2014, 10:29 PM
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,033
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Autonomous Switching With the Iterative Robot Template

You can use the same code as given in the tutorial. I believe the second argument to the chooser addObject() is just an object, so it can be anything -- not just a command. You can use the result of chooser.getSelected() to decide which autonomous behavior to perform.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
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 08:57 AM.

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