Go to Post What is it about inefficient design and operation that either pushes the envelope or deserves to be awarded? - Madison [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: 4 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 14-01-2013, 21:07
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Utilizing the Smart Dashboard

1) How to put a button on the dash? (like putting up a command puts the button to run the command)

2) It seems as though the "Save" function only saves the layout of the values and not their value. When you load the robot, SmartDashboard.getNumber() throws a TableNoKeyAtIndex error (meaning that it has no data). Is it possible to make a setup where you open an xml setup and it will automatically send all of the values to the cRIO?

3) What exactly does the "Robot Preferences" widget do? I thought it could be used for #2 but it seems their keys cannot contain [s]strings[/s] spaces //E: the [s] BBCode isnt in this vBulletin?

4) How would i convert a BinaryImage to a Sendable so I can show the BinaryImage on the dash?

5) So.. on the dashboard... I can convert an integer into a progress bar. Is there a way to make it a slider bar so i can input data without converting to plain text?

Last edited by Arhowk : 14-01-2013 at 21:27.
Reply With Quote
  #2   Spotlight this post!  
Unread 14-01-2013, 21:49
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by Arhowk View Post
1) How to put a button on the dash? (like putting up a command puts the button to run the command)
Check out the doc named "Testing Commands" from here:
http://wpilib.screenstepslive.com/s/3120/m/7932
and also here:
http://wpilib.screenstepslive.com/s/...-robot-program

Quote:
3) What exactly does the "Robot Preferences" widget do? I thought it could be used for #2 but it seems their keys cannot contain [s]strings[/s] spaces //E: the [s] BBCode isnt in this vBulletin?
It's a way of sending persistent values to the robot, as you were talking about in #2. The values are saved to the cRIO's flash memory and should remain there across reboots. I've never used it, so I don't know about the string limitation.

Quote:
5) So.. on the dashboard... I can convert an integer into a progress bar. Is there a way to make it a slider bar so i can input data without converting to plain text?
Yes, I believe you can do that using live window mode, or else you can create a new extension to do so (possibly using some source code from live window).
__________________
Research is what I’m doing when I don’t know what I’m doing.
- Wernher von Braun
Attending: Raleigh NC Regional
Reply With Quote
  #3   Spotlight this post!  
Unread 14-01-2013, 22:28
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by F22Rapture View Post
Check out the doc named "Testing Commands" from here:
http://wpilib.screenstepslive.com/s/3120/m/7932
and also here:
http://wpilib.screenstepslive.com/s/...-robot-program



It's a way of sending persistent values to the robot, as you were talking about in #2. The values are saved to the cRIO's flash memory and should remain there across reboots. I've never used it, so I don't know about the string limitation.



Yes, I believe you can do that using live window mode, or else you can create a new extension to do so (possibly using some source code from live window).
Not hooked up to a bot ATM, so cant test #2-3. Any documentation on #5 would be good.... cant find anything good in live window mode. For #1, so is there no way to do it without Commands? I do not like the Command-based robot system
Reply With Quote
  #4   Spotlight this post!  
Unread 14-01-2013, 23: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,572
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: Utilizing the Smart Dashboard

Quote:
Originally Posted by Arhowk View Post
1) How to put a button on the dash? (like putting up a command puts the button to run the command)
I haven't tried it, but it looks like NetworkButton will do what you want.
Reply With Quote
  #5   Spotlight this post!  
Unread 14-01-2013, 23:21
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by Arhowk View Post
For #1, so is there no way to do it without Commands? I do not like the Command-based robot system
Sure, but you'd have to emulate commands some how, so you'd end up using a similar structure anyway. It would take a whole lot more effort than it's worth when the ability is already built in.

Just out of curiosity, why don't you like Command-Based?
__________________
Research is what I’m doing when I don’t know what I’m doing.
- Wernher von Braun
Attending: Raleigh NC Regional
Reply With Quote
  #6   Spotlight this post!  
Unread 14-01-2013, 23:42
Djur's Avatar
Djur Djur is offline
WPILib
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Massachusetts
Posts: 182
Djur will become famous soon enough
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by Arhowk View Post
Not hooked up to a bot ATM, so cant test #2-3. Any documentation on #5 would be good.... cant find anything good in live window mode. For #1, so is there no way to do it without Commands? I do not like the Command-based robot system
A command button only works with commands. You would have to modify the SmartDashboard to be able to do what it seems like you want.

If you don't like command-based programming, I highly recommend that you use RobotBuilder to take care of the code's structure. It will be much simpler to use and understand.
__________________
WPILib dev (RobotBuilder, SmartDashboard, GRIP)
Reply With Quote
  #7   Spotlight this post!  
Unread 15-01-2013, 13:21
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by F22Rapture View Post
Sure, but you'd have to emulate commands some how, so you'd end up using a similar structure anyway. It would take a whole lot more effort than it's worth when the ability is already built in.

Just out of curiosity, why don't you like Command-Based?
Mainly just because i'm more familiar with the iterative format than the event-driven format and my mentors are much more familar with iterative so they know about as much as i do.

Quote:
Originally Posted by Djur View Post
A command button only works with commands. You would have to modify the SmartDashboard to be able to do what it seems like you want.

If you don't like command-based programming, I highly recommend that you use RobotBuilder to take care of the code's structure. It will be much simpler to use and understand.
why? RobotBuilder seems like all you do is just input a few values to move jags and it builds the code for you, which is not my style of coding... ive been coding for three years im familiar with the layout but its just that Smartdashboard is restrictive with its methods
Reply With Quote
  #8   Spotlight this post!  
Unread 15-01-2013, 18:10
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Utilizing the Smart Dashboard

Update: I don't understand this!! Robot preferences does not save. At all. Hitting the save button does nothing!
Reply With Quote
  #9   Spotlight this post!  
Unread 16-01-2013, 18:43
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by Arhowk View Post
1) How to put a button on the dash? (like putting up a command puts the button to run the command)

2) It seems as though the "Save" function only saves the layout of the values and not their value. When you load the robot, SmartDashboard.getNumber() throws a TableNoKeyAtIndex error (meaning that it has no data). Is it possible to make a setup where you open an xml setup and it will automatically send all of the values to the cRIO?

3) What exactly does the "Robot Preferences" widget do? I thought it could be used for #2 but it seems their keys cannot contain [s]strings[/s] spaces //E: the [s] BBCode isnt in this vBulletin?

4) How would i convert a BinaryImage to a Sendable so I can show the BinaryImage on the dash?

5) So.. on the dashboard... I can convert an integer into a progress bar. Is there a way to make it a slider bar so i can input data without converting to plain text?
none answered. shameless bump
Reply With Quote
  #10   Spotlight this post!  
Unread 17-01-2013, 12:54
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: Utilizing the Smart Dashboard

Quote:
Originally Posted by Arhowk View Post
1) How to put a button on the dash? (like putting up a command puts the button to run the command)
Anything extending WPILib's Trigger class will show up on the dashboard as a button -- including all of WPILib's Button types.

Quote:
Originally Posted by Arhowk View Post
2) It seems as though the "Save" function only saves the layout of the values and not their value. When you load the robot, SmartDashboard.getNumber() throws a TableNoKeyAtIndex error (meaning that it has no data). Is it possible to make a setup where you open an xml setup and it will automatically send all of the values to the cRIO?
SmartDashboard's "save" stores what widgets are loaded and their properties (size, color, etc.). SmartDashboard widgets aren't supposed to provide values to the robot; they're supposed to display them and allow them to be tweaked at runtime. If you want a value to stick around, change the value you give to put() on the robot or use Preferences.

Quote:
Originally Posted by Arhowk View Post
3) What exactly does the "Robot Preferences" widget do? I thought it could be used for #2 but it seems their keys cannot contain [s]strings[/s] spaces //E: the [s] BBCode isnt in this vBulletin?
The Robot Preferences widget puts a bunch of values into a network table so that the robot can read them. When you hit save, it sends another network table value telling the robot to save. The robot then saves the preference values (assuming you have a Preferences object on the robot) to the file wpilib-preferences.ini on the cRio, to be loaded again at a later time.

Quote:
Originally Posted by Arhowk View Post
4) How would i convert a BinaryImage to a Sendable so I can show the BinaryImage on the dash?
I don't even know if this is possible, but I know it would be a really bad idea. While binary images are much smaller than full-color ones, this will still result in a lot of network traffic. You'd have at least two video streams across the network -- one to the cRio from the camera, one to the laptop from the cRio. If you also have a feed to your dashboard, you now have three streams, two of which are full-color, and this becomes quite a load, possibly running over the network traffic limitations. If you want to be able to display different steps of the process live, I recommend doing your image processing on the laptop through a SmartDashboard widget -- for inspiration, you might want to look at Miss Daisy's vision system available here.

Quote:
Originally Posted by Arhowk View Post
5) So.. on the dashboard... I can convert an integer into a progress bar. Is there a way to make it a slider bar so i can input data without converting to plain text?
I believe you would have to make a custom widget using swing's NumberSlider object. That's what the LiveWindow speed controller widget does.
__________________
I code stuff.
Reply With Quote
  #11   Spotlight this post!  
Unread 17-01-2013, 13:01
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by Arhowk View Post
Update: I don't understand this!! Robot preferences does not save. At all. Hitting the save button does nothing!
You are probably saving the SmartDashboard preferences. Add the RobotPreferences widget to SmartDashboard (Edit>Add>RobotPreferences) and click the save button there.
__________________
All opinions are my own.
Reply With Quote
  #12   Spotlight this post!  
Unread 17-01-2013, 14:45
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Utilizing the Smart Dashboard

Quote:
Originally Posted by Ginto8 View Post
Anything extending WPILib's Trigger class will show up on the dashboard as a button -- including all of WPILib's Button types.


SmartDashboard's "save" stores what widgets are loaded and their properties (size, color, etc.). SmartDashboard widgets aren't supposed to provide values to the robot; they're supposed to display them and allow them to be tweaked at runtime. If you want a value to stick around, change the value you give to put() on the robot or use Preferences.


The Robot Preferences widget puts a bunch of values into a network table so that the robot can read them. When you hit save, it sends another network table value telling the robot to save. The robot then saves the preference values (assuming you have a Preferences object on the robot) to the file wpilib-preferences.ini on the cRio, to be loaded again at a later time.


I don't even know if this is possible, but I know it would be a really bad idea. While binary images are much smaller than full-color ones, this will still result in a lot of network traffic. You'd have at least two video streams across the network -- one to the cRio from the camera, one to the laptop from the cRio. If you also have a feed to your dashboard, you now have three streams, two of which are full-color, and this becomes quite a load, possibly running over the network traffic limitations. If you want to be able to display different steps of the process live, I recommend doing your image processing on the laptop through a SmartDashboard widget -- for inspiration, you might want to look at Miss Daisy's vision system available here.


I believe you would have to make a custom widget using swing's NumberSlider object. That's what the LiveWindow speed controller widget does.
Quote:
Originally Posted by joelg236 View Post
You are probably saving the SmartDashboard preferences. Add the RobotPreferences widget to SmartDashboard (Edit>Add>RobotPreferences) and click the save button there.
1) extending Trigger? Seems legit... ill look into it

2) see 3

3) I actually found documentation for the Preferences widget in the cookbook and it tells me to use the object Preferences. I got it kinda working (except for some stuff i gotta flush out) except when i try to load all of my stored preferences on robotInit, it will load (kinda) than give me an Out of Memory error (Not exception) than the dashboard will tell me No Robot Code and i have to re-deploy and get the same error

4) True.. ill look into it

5) I dont really follow you on this one...

joelg) read #3 on the Preferences object
Reply With Quote
  #13   Spotlight this post!  
Unread 17-01-2013, 17:59
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Utilizing the Smart Dashboard

What.... i posted and it said a moderator has to approve the thread and its still not there....

anyway, if it finally does show up, heres the exact error whenever i try to use the Preferences class

Code:
[cRIO] Done Reading
[cRIO] task 0x111b458 (FRC_cameraTask) deleted: errno=0 (0) status=0 (0U)
[cRIO] ncaught out of memory error on thread  - aborting isolate Server Connection Reader Thread
[cRIO] Tried to execute callbacks in the context of an isolate that is no longer alive: isolate 1 "edu.wpi.first.wpilibj.templates.RobotTemplate" (EXITED)
[cRIO] Skipping that set of callbacks
[cRIO] task 0x1126ed8 (cached TaskExecutor 1) deleted: errno=0 (0) status=0 (0)
[cRIO] 
[cRIO] 
[cRIO] --------------------------------------------------------------------
[cRIO] GCs: 1 full, 4 partial
[cRIO] ** VM stopped: exit code = 999 ** 
[cRIO] task 0xd1f738 (SquawkRobotTask) deleted: errno=0 (0) status=999 (0x3e7)
BUILD STOPPED (total time: 59 seconds)
e/ i guess santas not coming.

I get the above error when trying to use the Prefrences class... other stuff was just blabble
Reply With Quote
  #14   Spotlight this post!  
Unread 19-01-2013, 12:09
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Utilizing the Smart Dashboard

Code:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.buttons;
import edu.wpi.first.wpilibj.buttons.Trigger;
import edu.wpi.first.wpilibj.command.Command;

/**
 *
 * @author Arhowk
 */
public class t1684_SD_TakeImage extends Trigger{
    public boolean get(){return true;}
    public void whenActive(Command command){
        System.out.println("meh");
    }
    public void whileActive(Command command){
        System.out.println("meh2");
    }
    public void whenInactive(Command command){
        System.out.println("meh3");
    }
}
this displays the button on the dash but wont do anything when clicked...

still getting above error
Reply With Quote
  #15   Spotlight this post!  
Unread 19-01-2013, 14:00
SuperMario SuperMario is offline
Registered User
FRC #3692
 
Join Date: Jan 2013
Location: janesville
Posts: 9
SuperMario is an unknown quantity at this point
Re: Utilizing the Smart Dashboard

My team's idea for #4 was to save the processed image to the computer and have the smart dashboard read that file, but I don't know how to get the SmartDashboard to read an image.
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 13:26.

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