Go to Post I'm somewhat fond of saying, if your robot dosen't weigh 119.99 pounds, you forgot something. - Francis-134 [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 21-01-2016, 21:32
Tparbotmail Tparbotmail is offline
Registered User
FRC #3944
 
Join Date: Jan 2015
Location: Az
Posts: 69
Tparbotmail is an unknown quantity at this point
SendableChooser

"For instance, you may wish to be able to select between multiple autonomous modes. You can do this by putting every possible Command you want to run as an autonomous into a SendableChooser and then put it into the SmartDashboard to have a list of options appear on the laptop. Once autonomous starts, simply ask the SendableChooser what the selected value is."


The above is from the java doc. Is this intended for competition?
This is the line that makes me wonder
"Once autonomous starts, simply ask the SendableChooser what the selected value is."

How do you do ask the SendableChooser during competition? Is it intended such that you choose a value for an autonomous program you want to run? And then it just runs in autonomous portion of the competition?
Reply With Quote
  #2   Spotlight this post!  
Unread 24-01-2016, 10:12
fovea1959's Avatar
fovea1959 fovea1959 is offline
Herder of programmers
AKA: Doug Wegscheid
FRC #3620 (The Average Joes)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: St Joseph
Posts: 330
fovea1959 will become famous soon enough
Re: SendableChooser

If you are doing command based, you write a Command (often a CommandGroup) for each of your autonomous modes that you want your drivers to choose between. In robotInit, have the code send a SendableChooser to the smartdashboard, and populate the SendableChooser with the Commands you created. Driver places robot on the field, powers up, waits for communcation on the driver station, pulls up Smartdashboard, picks the one she wants for that match. In AutonomousInit() (which is called when autonomous starts), your code asks the SendableChooser for which one to run, and starts that one.

Clear example and verbage at https://wpilib.screenstepslive.com/s...smartdashboard.

If your code is *not* command based (IterativeRobot), the code can just send strings to the SendableChooser, and look to see what String got picked. If you do a File | New | Project ... | Robot Java Project (not Example Robot Java Project) | Iterative Robot, you get a nice little Iterative Robot that does this; you can copy and paste the relevant bits into your code.

Having the robot save the setting when it gets set so can retrieve the last used value when it powers up is nice; then the drivers can set the autonomous while still in queue and tethered to the robot. I read there were changes in WPILIBj around saving networktables settings, haven't looked at it yet. Get the easy version working first.
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 22:36.

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