Go to Post This is a community that builds people as well as knowledge. - Karibou [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 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
  #2   Spotlight this post!  
Unread 19-01-2016, 15:39
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
Re: GRIP NetworkTables

*crying* Somebody help please. Or at least give a working GRIP example in Java.
Reply With Quote
  #3   Spotlight this post!  
Unread 19-01-2016, 15:52
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP NetworkTables

What are you running GRIP on? Laptop? roboRIO? Coprocessor?

Can we see a screenshot of your GRIP program?

Are you running outlineviewer in client mode or server mode?
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
Reply With Quote
  #4   Spotlight this post!  
Unread 19-01-2016, 21:43
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
Quote:
Originally Posted by ThomasClark View Post
What are you running GRIP on? Laptop? roboRIO? Coprocessor?

Can we see a screenshot of your GRIP program?

Are you running outlineviewer in client mode or server mode?
GRIP is on the laptop, couldn't deploy to the RIO, not a big deal. Running in server mode on localhost. All of my values are changing in the outline viewer as they should. I just cannot for the life of me get the values into Java.
Reply With Quote
  #5   Spotlight this post!  
Unread 19-01-2016, 21:57
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP NetworkTables

Make sure your team number is set (Tools > Settings). That way, GRIP knows where to send NetworkTables values to.

Also, the roborio is supposed to run the NetworkTables server, so outlineviewer should be in client mode unless you're testing something without a roborio.
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
Reply With Quote
  #6   Spotlight this post!  
Unread 19-01-2016, 22:02
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
OK but why would it continue to return a static number repeatedly? And the FRC documentation says I can run it on the laptop. However the documentation hasn't exactly been correct so far BECAUSE THIS IS SO FRUSTRATING sorry I'm fine I swear.
Reply With Quote
  #7   Spotlight this post!  
Unread 19-01-2016, 22:04
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
Quote:
Originally Posted by origamitaco View Post
OK but why would it continue to return a static number repeatedly? And the FRC documentation says I can run it on the laptop. However the documentation hasn't exactly been correct so far BECAUSE THIS IS SO FRUSTRATING sorry I'm fine I swear.
I cannot deploy GRIP to the RoboRIO (along with a mass of people) but the patch is coming shortly. My outline viewer sees the values from GRIP. I can't show a screenshot as I am not near the robot or the laptop but the values are being seen by Java at least once it's just that number does not change
Reply With Quote
  #8   Spotlight this post!  
Unread 19-01-2016, 23:01
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP NetworkTables

Quote:
Originally Posted by origamitaco View Post
OK but why would it continue to return a static number repeatedly? And the FRC documentation says I can run it on the laptop. However the documentation hasn't exactly been correct so far BECAUSE THIS IS SO FRUSTRATING sorry I'm fine I swear.
You can use outline viewer to run a server on your laptop, but this is only useful when testing something that doesn't involve the roboRIO (ie: testing GRIP without a robot). If the roboRIO is part of the picture at all, it's probably running the networktables server.

I'm not sure why it would return a static number. It's possible that you got it deployed once and it put a number in NetworkTables, and now every time you run it's getting that same number back. Fixing the networktables server address should fix this
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC
Reply With Quote
  #9   Spotlight this post!  
Unread 20-01-2016, 15:34
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
Re: GRIP NetworkTables

Ok after a very long amount of time I finally got it to work. You are right, GRIP had to be run from the RIO, and the function of Outline Viewer's server is for anybody wanting to use a coprocessor. The code above was from WPI's official documentation on FIRST's website and it was completely irrelevant. I used the code from GRIP's GitHub page and I overcame the GRIP deployment by manually transferring the jar over with the .grip file. For anybody who is curious as to which jar you have to transfer (deployment is clearly an issue), it is the opencv-frc jar inside of appdata/local.
Reply With Quote
  #10   Spotlight this post!  
Unread 22-01-2016, 12:33
ThomasClark's Avatar
ThomasClark ThomasClark is offline
Registered User
FRC #0237
 
Join Date: Dec 2012
Location: Watertown, CT
Posts: 146
ThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud ofThomasClark has much to be proud of
Re: GRIP NetworkTables

Quote:
Originally Posted by origamitaco View Post
I used the code from GRIP's GitHub page and I overcame the GRIP deployment by manually transferring the jar over with the .grip file. For anybody who is curious as to which jar you have to transfer (deployment is clearly an issue), it is the opencv-frc jar inside of appdata/local.
FYI we have a new release with a much better deploy tool
__________________
GRIP (Graphically Represented Image Processing) - rapidly develop computer vision algorithms for FRC

Last edited by ThomasClark : 22-01-2016 at 16:55.
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 12:01.

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