![]() |
Network tables has already been initialized
We have been trying to use Network tables to grab variables from RoboRealm and use them in our robot program. We keep encountering an error whenever we even remotely use the NetworkTables class in our code.
Code:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team4959.robot.Robot java.lang.IllegalStateException: Network tables has already been initialized at [edu.wpi.first.wpilibj.networktables.NetworkTable.checkInit(NetworkTable.java:31), edu.wpi.first.wpilibj.networktables.NetworkTable.setPersistentFilename(NetworkTable.java:123), edu.wpi.first.wpilibj.RobotBase.<init>(RobotBase.java:63), edu.wpi.first.wpilibj.IterativeRobot.<init>(IterativeRobot.java:57), org.usfirst.frc.team4959.robot.Robot.<init>(Robot.java:26), sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method), sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62), sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45), java.lang.reflect.Constructor.newInstance(Constructor.java:408), java.lang.Class.newInstance(Class.java:433), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:204)]It is possible we are misusing RoboRealm as this is our first year using the software. We followed the basic tutorial and used the basic vision tracking file provided by RoboRealm. From there we have added our axis camera and successfully gotten feed into RoboRealm. After all the functions provided by the file made by RoboRealm we have created a network table to send variables though and selected the variables we want to send into the network. If you need any more information on our code just ask. You can find our git hub here We have not been able to find any other fix from our research on the internet (like 6th page of Google deep) so if anyone has an idea as to what to do or what we are doing wrong please help. Thank you! |
In your vision subsystem, you're initializing NetworkTables. Don't do this, the startup code for WPILib initializes it for you.
|
Re: Network tables has already been initialized
Oh sorry, the current git code is not exactly up to date. Anytime that we try to create or access a Network Tables object, it gives us the error above. No matter where we make it or what we do with it, it still gives us that error. Even without the initialize()
|
Re: Network tables has already been initialized
Without seeing your code, it's rather hard to help you out. How are you "creating a Network Tables object"?
|
Re: Network tables has already been initialized
This is some basic code we have been trying. We are still getting the same error. Any time we try to access the NetworkTables class we receive the error.
Code:
NetworkTable server; |
Re: Network tables has already been initialized
Here is an stand alone example program I have been using (run as a Java application, not as a Robot program) that connects to our network tables, monitors and then clears the "SmartDashboard" entries.
If you are running your program outside of a robot project, then maybe the way we do our set up would apply to you as well. Code:
package com.techhounds.dashboard; |
Re: Network tables has already been initialized
Quote:
|
Re: Network tables has already been initialized
Quote:
EDIT: So it turns out that the source of the error is NetworkTable.setIPAddress(), whether it's called before or after NetworkTable.getTable(). |
Re: Network tables has already been initialized
I don't think you should be calling initialize. For us, we made an application that runs on the desktop and can communicate via
Code:
NetworkTable.setClientMode(); |
Re: Network tables has already been initialized
The demo program I included was for a stand alone Java application (it runs outside of the Robot code and outside of the SmartDashboard).
It sounds like you are creating a SmartDashboard extension (plugin) module that is loaded by the SmartDashboard and run inside the SmartDashboard. If this is the case, then my guess is that the SmartDashboard has already set up and constructed the single instance of the NetworkTable connection object. If you want to update values in a network table, my assumption is that you would skip all of the initialization steps and just grab the table you want to work with when you want to put a value out (similar to what you would do in Robot code). Something like: Code:
NetworkTable table = NetworkTable.getTable("SmartDashboard"); |
| All times are GMT -5. The time now is 08:01 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi