Go to Post my least favorite thread is that one just hanging from my favorite shirt. - Stuart [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-06-2012, 10:04 PM
gizzerd91 gizzerd91 is offline
Registered User
FRC #2498
 
Join Date: Feb 2012
Location: Minneapolis
Posts: 11
gizzerd91 is an unknown quantity at this point
1st Post! ZomB Dashboard Troubles

Long time lurker, first time posting. Hello everybody!

I'm trying to create a simple slider in ZomB that will let me set the speed of our shooter for testing out the range/rpm ratio on our shooter. I set up a slider in Visual ZomB, named it "Shooter Speed", and then wrote in my teleopPeriodic() in Java
Code:
try {
     shooterGoalSpeed = dashboard.getInt("Shooter Speed");
} catch (NetworkTableKeyNotDefined ex) {
     ex.printStackTrace();
}
Trouble is, I keep getting the NetworkTableKeyNotDefined exception
Code:
[cRIO]edu.wpi.first.wpilibj.networktables.NetworkTableKeyNotDefined
[cRIO]     at edu.wpi.first.wpilibj.networktables.NetworkTable.getInt(NetworkTable.java:522)
[cRIO]     at edu.wpi.first.wpilibj.smartdashboard.SmartDashboard.getInt(SmartDashboard.java:140)
[cRIO]     at edu.wpi.first.wpilibj.templates.RobotTemplate.teleopPeriodic(RobotTemplate.java:147)
[cRIO]     at edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:145)
[cRIO]     at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase.java:156)
[cRIO]     in virtual method #10 of javax.microedition.midlet.MIDlet(bci=17)
[cRIO]     at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(64)
[cRIO]     at com.sun.squawk.imp.MIDletMainWrapper.main(110)
[cRIO]     in virtual method #95 of com.sun.squawk.Klass(bci=25)
[cRIO]     at com.sun.squawk.Isolate.run(1506)
[cRIO]     at java.lang.Thread.run(231)
[cRIO]     in virtual method #47 of com.sun.squawk.VMThread(bci=42)
[cRIO]     in static method #3 of com.sun.squawk.VM(bci=6)
I've tried all the different data types, and all sorts of different component names (without spaces, with numbers, etc), but nothing helps. I'm sure this is something stupid I overlooked, but I've been at it four hours and I'm not making any headway. Any ideas?
My ZomB Dashboard is working great otherwise, I have encoders mapped to graphs and the camera is showing up. It's an awesome program. If you haven't tried it out, I would highly recommend it.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-07-2012, 07:09 AM
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 102
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: 1st Post! ZomB Dashboard Troubles

We ran across this same issue at one point. I don't have the robot in front of me, but I think the solution was to add a line in the robot initialization code to set a initial value for each SmartDashboard key name we wanted to retrieve before we started retrieving it.

Here's a example (from a SimpleRobot based perspective):

Code:
private int shooterSpeed = 0;

public void robotInit() {
  // Tell SmartDashboard to register a "Shooter Speed" key and initial value.
  SmartDashboard.putInt("Shooter Speed", shooterSpeed);
}

public void operatorControl() {

   while (isOperatorControl() && isEnabled()) {

      // Read value of "Shooter Speed" back from the dashboard
      int newSpeed = SmartDashboard.getInt("Shooter Speed", shooterSpeed);

      // If operator wants a new speed, update robot state to accomodate
      if (newSpeed != shooterSpeed) {
        doWhatYouNeedToDoOnASpeedChange(newSpeed);
      }

      Timer.delay(0.01);
   }

}
Reply With Quote
  #3   Spotlight this post!  
Unread 02-07-2012, 08:54 PM
gizzerd91 gizzerd91 is offline
Registered User
FRC #2498
 
Join Date: Feb 2012
Location: Minneapolis
Posts: 11
gizzerd91 is an unknown quantity at this point
Re: 1st Post! ZomB Dashboard Troubles

We tested that already, and it doesn't help. I'm switching to SmartDashboard, so I just wrote a custom widget that gets at the NetworkTable from within the program. Haven't tested it yet, but that seems like it should work. I'll test it as soon as I get back into the shop.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-09-2012, 03:11 PM
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: 1st Post! ZomB Dashboard Troubles

what control are you using? some controls don't send data back
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
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 08:54 AM.

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