|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Access the Auto List on Driver Station in Java
Hello All,
Last weekend we had our first competition. We were using the Smart Dashboard with radio buttons to select our various autonomous modes. It didn't work very well and many others told us they had difficulty using the Smart Dashboard for this purpose. Even though the Smart Dashboard selected the desired autonomous mode I think it had to be selected after the laptop was connected to the robot through the competition system. It was quite error prone for the kids. I would like to use LV Driver Station to choose the autonomous mode. Under the Drive tab in the driver station there is a blank drop down. Does anyone know how to access this drop dow?. Essentially setup strings and then read from it. I read a little bit, but it all seems to be describing LV to access it via "Auto List" and "Auto Selector" Thanks. Chris |
|
#2
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
Here's some sample code that should get you started.
Class members: final String defaultAuto = "Default"; final String customAuto = "My Auto"; String[] autoList = {defaultAuto, customAuto}; String autoSelected; in robotInit(): NetworkTable table = NetworkTable.getTable("SmartDashboard"); table.putStringArray("Auto List", autoList); in autonomousInit(): autoSelected = (String) chooser.getSelected(); System.out.println("Auto selected: " + autoSelected); in autonomousPeriodic(): switch(autoSelected) { case customAuto: //Put custom auto code here break; case defaultAuto: default: //Put default auto code here break; } |
|
#3
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
Regarding the SmartDashboard, we've had the same issues. We've told our drive team to make each selection twice, and that seems to do the trick. We will be moving (running?) away from the SmartDashboard in future events.
|
|
#4
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
Thank you Ruffles for the advice and I appreciate the validation of our troubles Ben. I will try this code the next time the team meets.
Chris Last edited by RSNovi : 11-03-2016 at 20:03. |
|
#5
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
Quote:
should be something like this instead: autoSelected = SmartDashboard.getString("Auto Selector", defaultAuto); |
|
#6
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
My team decided to use a hardware solution instead. We put a 12-position rotary switch on the robot. It has a little led to indicate which position is selected and it's easy to read using an analog input on the Roborio.
http://www.robotshop.com/en/rotary-e...module-v1.html |
|
#7
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
We had a similar problem but with only two auto modes (cross low bar or don't move). We wound up using the throttle on a joystick for it - there is no rule against reading joystick inputs from the driver station during autonomous, just against drivers touching any of them during that period. If you have more than two modes, you might try building a multi-position selector you can hook up over USB using a TI Launchpad.
|
|
#8
|
||||
|
||||
|
We had the same issue last year using LabVIEW but after switching to Java this year we've had no problems with SmartDashboard or Sendable Choosers.
|
|
#9
|
||||
|
||||
|
Re: Access the Auto List on Driver Station in Java
Quote:
https://github.com/trc492/Frc2016Fir...utonomous.java |
|
#10
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
Quote:
|
|
#11
|
||||
|
||||
|
Re: Access the Auto List on Driver Station in Java
It doesn't matter. The selection actually sticks meaning even for the next match if you don't select anything else, the previous selection is still in effect until you select something different.
|
|
#12
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
Quote:
If you get a chance please let me know if you see anything public void robotInit() { |
|
#13
|
||||
|
||||
|
Re: Access the Auto List on Driver Station in Java
Quote:
Last edited by mikets : 18-03-2016 at 15:04. |
|
#14
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
Quote:
When the game was activated I think it just ran the default of Do Nothing even one of the Low Bar options was selected. No errors that I know of. The one time we did get it to work I was at the driver station and i toggled the buttons back and forth after the robot was connected to the system. After a few failures we just hard coded the one choice. During practicing at our school the buttons seemed to work fine. I will look into newing all of the commands. Last edited by RSNovi : 18-03-2016 at 19:59. |
|
#15
|
|||
|
|||
|
Re: Access the Auto List on Driver Station in Java
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|