Go to Post I think there are a ton of teams that would kill for one let alone three engineering mentors (especially one with the knowledge and experience that Rich Olivera has). - XaulZan11 [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 Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 13-08-2013, 17:38
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
Interactive Widgets on SmartDashboard

one of the things we want to do is to put a graphical slider or checkbox on the SmartDashboard and have the operator interact with it on the driver station. This is something that was pretty easy with LabView, and we used it a lot during testing.

I've seen the SendableChooser, we're looking for something similar that can handle numbers...

This doesn't seem to be a capability built into the SmartDashboard. Is this something that anyone has done?
Reply With Quote
  #2   Spotlight this post!  
Unread 13-08-2013, 18:03
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Interactive Widgets on SmartDashboard

If you use SmartDashboard.putNumber in your robot code, a number widget will pop up on SmartDashboard. You can change the widget type to view the data differently (http://wpilib.screenstepslive.com/s/...e-for-a-value). You can then change that value on the SmartDashboard and read the changed value on the robot with getNumber. You can do something similar with put/getBoolean.
Reply With Quote
  #3   Spotlight this post!  
Unread 13-08-2013, 18:16
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Interactive Widgets on SmartDashboard

This is entirely possible. The key is that its not part of the smart dashboard, its part of the live window, which you will typically run while your robot is in test mode. Just use the various methods of the LiveWindow class in the same way you would use the smart dashboard.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-08-2013, 09:38
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: Interactive Widgets on SmartDashboard

the "interactive" part is the part I'm not seeing. I want a slider that I can manipulate on the Dashboard and have the change reflected in NetworkTables so I can read the slider value in the robot. I know we can do it by typing in valkues: we're looking for GUI widgets that we can manipulate....

will look at LiveWindow classes over weekend, perhaps what I am looking for is in there?
Reply With Quote
  #5   Spotlight this post!  
Unread 15-08-2013, 10:22
Pault's Avatar
Pault Pault is offline
Registered User
FRC #0246 (Overclocked)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston
Posts: 618
Pault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond reputePault has a reputation beyond repute
Re: Interactive Widgets on SmartDashboard

Ok, now I am confused about what you are trying to do. Could you please give us a specific example.

LiveWindow only works during testing, you can't use it during an actual match. And what it is able to do is either give you a slider to change to speed of a motor (-1 to 1) and also work with PID (adjust the P I and D values and tell the motor to go to a setpoint).
Reply With Quote
  #6   Spotlight this post!  
Unread 17-08-2013, 17:34
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: Interactive Widgets on SmartDashboard

I want the same capability we have with LabView. We can add GUI widgets to the LV Dashboard, and the value of the widgets are tied to what's in the SmartDashboard network tables. If the GUI widget is a LV "indicator", then it just reflects what's in the network table, if it's a LV "control", then changing what's on the dashboard will change the corresponding table entry.

The Java SmartDashboard has some of this, but doesn't seem to have GUi elements; I can't tie a slider to a number in the NetworkTable, for instance; my only display option is a text box.

We can work around it; Test mode gets us part of the way there, using the "fake" analog and digital inputs on the DS helps more (or building a real console with the Cypress), but I wanted to be sure that I wasn't missing a capability that was already there.

Writing a Swing application to present a UI and poke/read the network tables is straightforward, but doing and persisting the GUI layout would be a challenge for where I am right now, Swing-wise (I'm a J2EE guy)...
Reply With Quote
  #7   Spotlight this post!  
Unread 18-08-2013, 15:17
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Interactive Widgets on SmartDashboard

If you call SmartDashboard.putX() on the robot, where X is any of the supported data types, there actually isn't any magic happening here; it just puts it into a NetworkTable named "SmartDashboard". On the dashboard, it listens for changes to this table and adds widgets accordingly. The default widgets for basic data types allow you to modify these values; just click in the text box and type a new value. These will be placed back into the NetworkTable, and can be retrieved with SmartDashboard.getX() (you can also use a ITableListener to detect updates). I don't believe there is a slider option for normal SmartDashboard use, but if you grab the source code it should be possible to take the LiveWindow slider, convert it to a normal widget, and compile it as an extension.
__________________
I code stuff.
Reply With Quote
  #8   Spotlight this post!  
Unread 18-08-2013, 21: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: Interactive Widgets on SmartDashboard

yeah. I finally stumbled on the "writing extensions" part of the wiki, and the scales were lifted from my eyes. A mention of that tutorial in the SmartDashboard ScreenSteps or the video tutorials would be appropriate, hopefully one of the really clever WPI people will see this

Need to look at the code for the Textbox widget to see how changes get reflected back (looks like they rely on the Swing ChangeEvent). If I can adapt a JSlider or JSpinner as a POC (making the editable property work, which looks straightforward), then we're home free; once you've done it once, the variations are relatively easy. It just looks like a few hours work, need to find the hours.

As a professional Java developer, I gotta say the SmartDashboard is a slick piece of work. I tore into Team 341's 2012 DaisyCV, and a lot of things are getting *very* clear.

Last edited by fovea1959 : 18-08-2013 at 21:16.
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 10:01.

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