Go to Post Analysis is a tool. Like any other tool you need to figure out where and when to use it. That's the tricky part. - ChrisH [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #22   Spotlight this post!  
Unread 13-01-2016, 18:40
shlynfrhm shlynfrhm is offline
Registered User
FRC #3039 (Wildcat Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Cambridge, MA
Posts: 6
shlynfrhm is an unknown quantity at this point
Re: We are going to Want a GRIP fourm

Hey, I'm also having problems accessing the data from my NetworkTables. This is my code, and I've also imported NetworkTables before my program. I'm not able to see live publishing from GRIP to the Network Tables, has anyone been able to successfully do this and could give me an example? I followed the instructions on WPILib, but I feel as if I'm missing some code. Also, we program in command-based and I'm not sure where to implement this code in that format.

Code:
public class Robot extends SampleRobot {
    final String defaultAuto = "Default";
    final String customAuto = "My Auto";
    String autoSelected;
    SendableChooser chooser;
    NetworkTable table;
	
    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public Robot() {
    	table = NetworkTable.getTable("/GRIP/myContoursReport");
    }
    public void robotInit() {
    	
        chooser = new SendableChooser();
        chooser.addDefault("Default Auto", defaultAuto);
        chooser.addObject("My Auto", customAuto);
        SmartDashboard.putData("Auto choices", chooser);
        double[] defaultValue = new double[0];
        while(true){
        	double[]areas=table.getNumberArray("area", defaultValue);
        	System.out.print("areas:");
        	for(double area:areas){
        		System.out.print(area + " ");
        	}
        	System.out.println();
        	Timer.delay(1);
        }
    }
Thanks!
Ashlyn
 


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 07:14.

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