![]() |
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 |
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; } |
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.
|
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 |
Re: Access the Auto List on Driver Station in Java
Quote:
should be something like this instead: autoSelected = SmartDashboard.getString("Auto Selector", defaultAuto); |
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 |
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.
|
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.
|
Re: Access the Auto List on Driver Station in Java
Quote:
https://github.com/trc492/Frc2016Fir...utonomous.java |
Re: Access the Auto List on Driver Station in Java
Quote:
|
Re: Access the Auto List on Driver Station in Java
Quote:
|
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() { |
Re: Access the Auto List on Driver Station in Java
Quote:
|
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. |
Re: Access the Auto List on Driver Station in Java
Quote:
|
Re: Access the Auto List on Driver Station in Java
Quote:
|
Re: Access the Auto List on Driver Station in Java
We just competed in the NY Tech Valley Regional this weekend and had a number of problems with Robot<->FMS<->DS SmartDashboard issues.
Aside from using several SendableChoosers to select auto and speed settings (don't need full speed for low-bar, do want to catch some air for the rock-wall), we use about 20 tunables on our SmartDashboard to help compensate for limited practice time, and some RoboRIO quirks (3 cameras, what was cam0 could be cam2 or cam3 next reboot). When it worked, it worked well.... It took most of our practice matches to figure out the problems. Match Scoring Delays - Refs would occasionally hold scores for a match for what seemed like a very long time all weekend long. While this was happening, field reset would be under way and the students are setting up the robot and DS. But because the prior match hasn't been scored yet, FMS is still configured for the last match. In some instances the MC was announcing teams immediately after the LCD station indicators had changed. FMS Setup Lag - From the time the FMS starts to setup the field, which seems to start with the changing of the team numbers above the station, it takes at least 30-45s, and sometimes over a minute, to begin to connect the DS to FMS and the Robot to the network. SmartDashboard / NetworkTables - Because the Robot is online this whole time, it's broadcasting it's NetworkTables settings (defaults) to the void. (Remember SmartDashboard is backed by NetworkTables). The DS is doing the same on it's side of the field, but unable to talk to each other yet. If the DS had been completely shut down since the last time it saw the Robot, it will have no settings, or it will still think it's NetworkTables are "good" from the last connection to the robot. Meeting of the Minds - Eventually you'll get FMS comms, Robot comms, and Robot Code on the DS, and NetworkTables attempts to sync between the DS and Robot. It's "supposed" to come to a consensus and have a unified view at this point. The SmartDashboard in lala-land - If you had your DS up, and NetworkTables had to come to consensus and you had your SmartDashboard open before you had Robot Code indication on the DS, this is where things fall off the rails. A good number of times we'd see "stale" settings and values on the SmartDashboard, when looking at the "Default" dashboard table were wrong on the SmartDashboard. Our solution was to tell the drive team to go to the SmartDashboard and File->New at this point after Robot Code is indicated. (You may be able to File->Load instead, but we never had the time to setup a really nice view we wanted to keep, we were adding/removing fields too quickly.) ... At this point you should be ready to configure your auto and any other settings you need. On our Robot we had 3 video cameras, and all too often they would juggle on a reboot. So we used 3 SmartDashboard strings to configure them. It would take the students a few seconds to identify which camera was which, make the settings, and verify, as well as set the auto, and tune the settings for the obstacle they were facing. (Once we had good numbers, this last step became unneeded.) They would also force calibrate the gyro at this point. But the match started?!!? This bit us way too many times -- because it took some time to get the settings in and calibration to complete, field reset had been finished well before FMS was ready. I had our drive captain go the to Head Ref and explain what was happening (score delay, fast field reset, FMS late setup, and a fast start), and he admitted he hadn't seen us trying to wave off the start of the match. From that point the 2-3 drive team members not working on the DS were up on the glass with thumbs-down and the refs would check before giving the go-ahead. TL;DR - SmartDashboard can be in lala land, try File->New once you have Comms. FMS takes too long to setup comms most times, this is worst on a fast field reset, and a long prior-match score delay. Make sure your HR knows you have some setup work to do and SmartDashboard is a bit buggy and use that thumbs-down to hold the match start. |
Re: Access the Auto List on Driver Station in Java
Quote:
|
Re: Access the Auto List on Driver Station in Java
One thing we did to make things more reliable was to make sure that the Preferences had the last picked autonomous settings. That way the robot can come up and the drivers are confident that the settings they had in queue will be what they see when the robot boots on the field.
|
| All times are GMT -5. The time now is 02:31 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi