Go to Post This is the first (and, if this stuff keeps up, last) time FIRST has allowed high-speed projectiles in years. Please use some common sense, people. - 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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 19-01-2016, 13:16
origamitaco origamitaco is offline
Registered User
FRC #4328
 
Join Date: Nov 2015
Location: Richmond, TX
Posts: 35
origamitaco is an unknown quantity at this point
GRIP NetworkTables

I finally was able to pull information from the GRIP NetworkTables but was very disappointed when I only got a static number (area: 1045.5) repeatedly. Even after a reboot of the code the number remained the same. If I take this code out entirely and then run it and then put the code back in and run it then the number changes to whatever the first number from the NetworkTables is, but of course it remains static and repeats itself. My numbers inside the Outline Viewer are constantly changing so I have no idea why this is happening. Here is my code
Code:
package org.usfirst.frc4328.Robot2016.commands;

import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.networktables.*;

/**
 *
 */
public class getAim extends Command {
	
    public getAim() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
    	
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    	double[] defaultValue = new double[0];
    	while (true) {
    		double[] areas = NetworkTable.getTable("GRIP/Test").getNumberArray("area", defaultValue);
    		System.out.print("areas: ");
    		for (double area : areas) {
    			System.out.print(area + " ");
    		}
    		System.out.println();
    		Timer.delay(1);
    	}
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}
Reply With Quote
 


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:43.

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