Go to Post FRC is a game of mentors. The best teams are guided by mentors who know how to balance on the knife edge of pushing the envelope and achieving success. - Mr. Van [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 06-02-2011, 15:29
chadbarbe1 chadbarbe1 is offline
Registered User
AKA: Chad Barbe
FRC #1450 (XQ Robitx)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2006
Location: Rochester, NY
Posts: 8
chadbarbe1 is an unknown quantity at this point
Reading input from NetConsole

I was reading this link:

http://firstforge.wpi.edu/sf/wiki/do...FAQ-NetConsole

And it says that NetConsole provides a bi-directional link between some external client program and the cRIO. It also says that the NetConsole client is built into the NetBeans plugins. This implies that you could create a simple command line menu in your NetBeans console to intereact with the application running on your robot.

I can see that System.out is directed to the NetBeans console but how do you read input typed into that console with your Java code? System.in does not seem to even be a valid symbol.

Thanks!

CHAD
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2011, 23:09
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Re: Reading input from NetConsole

Not sure how you'd send it to the cRIO, but in order to read input from the keyboard, you'd do the following
Code:
import java.util.Scanner;
main{
Scanner scn = new Scanner(System.in);
System.out.println("Enter command:");
string command = scn.nextLine();//or it might be scn.nextString()
//Send command to cRIO
}
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 07-02-2011, 08:18
chadbarbe1 chadbarbe1 is offline
Registered User
AKA: Chad Barbe
FRC #1450 (XQ Robitx)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2006
Location: Rochester, NY
Posts: 8
chadbarbe1 is an unknown quantity at this point
Re: Reading input from NetConsole

Thanks for the reply kinganu123!

Unfortunately, the Scanner and System.in approach was the first thing i tried. Have you gotten that code to compile for the robot? It would seem we are relegated to java 1.4 in which the Scannner class does not exist.

I think the real question I have is, is there any documentation on the NetConsole server and how to interact with it from user robot code running on the cRIO?
Reply With Quote
  #4   Spotlight this post!  
Unread 07-02-2011, 09:41
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Reading input from NetConsole

One thing to realize is that the port that netconsole uses is blocked by the field, so anything you develop could be for home use only.
Reply With Quote
  #5   Spotlight this post!  
Unread 07-02-2011, 09:47
chadbarbe1 chadbarbe1 is offline
Registered User
AKA: Chad Barbe
FRC #1450 (XQ Robitx)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2006
Location: Rochester, NY
Posts: 8
chadbarbe1 is an unknown quantity at this point
Re: Reading input from NetConsole

Joe- understood. I want to implement a command line menu to help me tune my pid controllers without recompiling every 5 seconds. This is for development purposes only of course.
Reply With Quote
  #6   Spotlight this post!  
Unread 07-02-2011, 15:11
Patrickwhite's Avatar
Patrickwhite Patrickwhite is offline
May the North be with you
FRC #0610 (The Coyotes)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Toronto
Posts: 88
Patrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of light
Re: Reading input from NetConsole

It seems that the NetConsole was developed primarily for C/C++ users wanting to see output directly from the robot, with the sending function added as an unfinished afterthought. The documentation, as you've discovered, is almost nonexistent. A search on CD turns up nothing regarding sending through NetConsole.
You may wish to try using old-fashioned methods, like the Analog Inputs on the driver station. While tuning our PID loops, we used unused buttons on the gamepad we were using to increment and decrement the values and having the DriverStationLCD read the values itself.
__________________
while(!going.isTough());
tough.exit();

What will we do tonight, Warfa?
The same thing we do every night, Patrick. Sit and wait for Electrical.
Reply With Quote
  #7   Spotlight this post!  
Unread 08-02-2011, 02:29
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Reading input from NetConsole

NetConsole is bidirectional and is implemented fully in both directions. The documentation does leave a bit to be desired at this point, but when I implemented it, there was very little to it and no options to speak of.

That being said, I'm not sure that this applies well to Java since there are (probably) two pieces missing in that part of the world. The NetConsole client code that's built into NetBeans plugin is (probably) not bidirectional (I haven't tried it, but I'm not aware of that being a use-case that was considered). I'm also not sure that the JVM implements the methods needed to read from the terminal. Perhaps Derek can chime in.

In C++, scanf or getc can be used to read from the terminal (serial or NetConsole, it doesn't know the difference) and the standalone NetConsole client sends and receives (I use this regularly to reboot the robot with ctrl-x and to run VxWorks commands on the console). You may be able to simply call the C functions for reading from the console through the JNA interfaces and then use the standalone NetConsole client. One complication that you may run into is how to start your application such that the console is bound to your task and is not bound to the shell. I haven't tried that aspect of it in the context of a robot program.

-Joe
Reply With Quote
  #8   Spotlight this post!  
Unread 08-02-2011, 07:48
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: Reading input from NetConsole

Quote:
Originally Posted by chadbarbe1 View Post
Joe- understood. I want to implement a command line menu to help me tune my pid controllers without recompiling every 5 seconds. This is for development purposes only of course.
This doesn't help reading from the console but does address what you are trying to do: add a potentiometer to an analog in and scale the value to the P, I, or D range you are trying. Its fast and no typing.
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 11:19.

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