OCCRA
Go to Post If you don't manage weight from the beginning, weight will manage you at the end. - charrisTTI [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media  
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 03-23-2018, 10:20 PM
rd5 rd5 is offline
Registered User
FRC #5162
 
Join Date: Nov 2017
Location: Michigan
Posts: 13
rd5 is an unknown quantity at this point
SmartDashboard GetString() Not Working

Hello,

My team has a dashboard issue that plagued us today. In our cpp code, three strings are read in with SmartDashboard::GetString() to collect what auton we entered, backup auton (for the other side of the switch being our color), and our field position. We experienced in about 50% of our games, some of which where the one of two strings would read, but not the other, the GetString() returning an empty string in an otherwise visibly filled out field.

As far as we can tell, this only happens in actual matches. In the pit, on the practice field, the code receives the correct input 100% of the time with various checks I have to make sure the text field - visibly filled in to us - isn't "secretly" empty, such as manually clearing the text fields on DisabledInit, clearing the fields if GetString() returns empty in DisabledPeriodic, and only reading in the data if it's not an empty string.

Despite all of this, our auton in the last game mind bendingly did not have GetString() return "" in DisabledPeriodic, but when AutonInit occurred, it read in blank anyways (and I made the mistake of inserting a default "cross the line" auton instead of just not changing the read in auton from earlier, if it was working earlier that is).

I'm so confused.

Should I just read in from a text file? Is that more reliable than the "Smart"Dashboard?
Reply With Quote
  #2   Spotlight this post!  
Unread 03-24-2018, 02:55 AM
Peter Johnson Peter Johnson is offline
Volunteer WPILib Developer, CSA
no team (WPILib)
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 536
Peter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond reputePeter Johnson has a reputation beyond repute
Re: SmartDashboard GetString() Not Working

What version of the plugins are you on? You might want to try Shuffleboard as well.
__________________
WPILib Developer, 2014-Present:
  • Author of cscore - WPILib CameraServer for 2017+
  • Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC
Mentor, Team 294, 2008-2018 (World Champions FRC 2010 & FTC 2008)
Reply With Quote
  #3   Spotlight this post!  
Unread 03-24-2018, 09:51 AM
rd5 rd5 is offline
Registered User
FRC #5162
 
Join Date: Nov 2017
Location: Michigan
Posts: 13
rd5 is an unknown quantity at this point
Re: SmartDashboard GetString() Not Working

Quote:
Originally Posted by Peter Johnson View Post
What version of the plugins are you on? You might want to try Shuffleboard as well.
2018.2.2. I posted this on the Programming forum and someone suggested that it was AutonInit during matches that was messing it up. I'm reading it out of only DisabledPeriodic now, and it seems to be working.

Now the dashboard puts back the string it gets as it gets it, and I was able to determine that GetString() doesn't work because the DriverStation has some kind of connection issue between closing the laptop/disconnecting/idk. Rebooting the DriverStation would open up the DashBoard and even autopopulate the text fields with what failed to read in last time. Figures.

https://github.com/RyanDraves/FRC-2018-Team-5162 is the code.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-26-2018, 02:02 PM
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 195
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: SmartDashboard GetString() Not Working

The best way to do autonomous play-choosing is using the SendableChooser class. The docs aren't bad, but they lend themselves to Command based robots and "plays" if you don't get a little creative. However, there are some great threads here in the C++ area which cover how to use it with either addresses or pointers to strings which make your logic super easy to implement. It is the "intended" way that WPI has given teams for selecting autonomous plays.
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
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 06:22 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi