RConsole.openAny(x) never times out

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

RConsole.openAny(x) never times out

Postby spiked3 » Sun Feb 12, 2012 10:40 pm

from the documentation;
"If open is not called or if the connection to the PC is timed out, then the output is discarded"

but this does not seem to be the case - the brick just waits until a console connects.

Also, anyone have a Console that runs on Android?
spiked3
New User
 
Posts: 18
Joined: Tue Feb 01, 2011 3:20 am
Location: east TN, US

Re: RConsole.openAny(x) never times out

Postby gloomyandy » Mon Feb 13, 2012 9:26 pm

Hi,
Do you have a small test program for this. I've just tried it with the following:

Code: Select all
  public static void main (String[] aArg)
  throws Exception
  {

      RConsole.openAny(10000);
      LCD.drawString("RConsole complete",3,4);
     Thread.sleep(20000);
  }


and it does pretty much as I would expect. Waits for 10 seconds then displays the RConsole complete message.

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4083
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: RConsole.openAny(x) never times out

Postby spiked3 » Mon Feb 13, 2012 10:31 pm

I do not have a small program that does it, and since i posted I did write another 'utility' small program and it did as expected also.

this is the start of the bigger program that never times out;

public static void main(String[] args) {

LCD.drawString("LeJOS3", 2,1);

RConsole.openAny(5);
RConsole.println("Startup");

d = new DataModel();
d.lightSensor = new LightSensor(SensorPort.S1);
d.lightMotor = new NXTRegulatedMotor(MotorPort.A);
d.lightMotorBaseTacho = d.lightMotor.getTachoCount(); // consider this 0

d.pilot = new DifferentialPilot(4.96f, 13.0f, new NXTRegulatedMotor(MotorPort.C), new NXTRegulatedMotor(MotorPort.B), false);

Behavior [] bArray = {
new DriveBehavior(),
new LineFollowBehavior4(),
new ButtonBehavior(),
}; // in priority order, lowest to highest

...... etc.

I've tried many different values (the docs are not clear if it expects milliseconds or seconds, and actually I think one sample I read said seconds).
spiked3
New User
 
Posts: 18
Joined: Tue Feb 01, 2011 3:20 am
Location: east TN, US

Re: RConsole.openAny(x) never times out

Postby gloomyandy » Mon Feb 13, 2012 10:45 pm

The timeout period is in mS (like most of the time values in leJOS). The docs need cleaning up for this...

I've tried to reproduce the problem but all of my tests work fine. Do you still see the problem with your code? If so can you add an extra drawString call immediately after the openAny call just to confirm that it is this call that is hanging.

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4083
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: RConsole.openAny(x) never times out

Postby spiked3 » Mon Feb 13, 2012 11:55 pm

It really is behaving unexplained at the moment. If I sit and wait for a timeout, it seems to go into never never land, not executing the code after the openAny, and not opening a remote console either. If I connect a remote console (within the time out period), the code following executes as expected.

Unfortunately for me, after 2 days, I've hit my first Java exception (after the expected initialization routine runs), and have gotten nowhere figuring out how to understand it. I see on the web page talk about using command lines, which I do not do, and I guess the IDE integration stuff has a ways to go. Is there even a way to set linker options in Eclipse? I haven't found them. And when I do, then what?

I love what you guys did with LeJOS (remember I even tried to copy it to C# one time but the regulator thread differences between Java and C# got too complicated for me and I gave up). But I wish the development experience was more in line with android, which is also a separate remote jvm. It may be just too complicated for me at this time as some health issues severely limit my patience. Again, at this moment, I'm ready to give up and go another direction, but to the best of my knowledge, I've already tried them all and they are just too archaic.
spiked3
New User
 
Posts: 18
Joined: Tue Feb 01, 2011 3:20 am
Location: east TN, US

Re: RConsole.openAny(x) never times out

Postby skoehler » Tue Feb 14, 2012 12:15 am

spiked3 wrote:I see on the web page talk about using command lines, which I do not do, and I guess the IDE integration stuff has a ways to go.


At the moment, nxjdebugtool (the command line tool) is the only way to fully decode exceptions such that you do not only get the name of the method but also the line at which the exception happened. What is that "which I do not do" part of your sentence about? Are you refusing to use the command line?

There is currently no support in Eclipse to decode Exceptions for you. However, nxjconsole support decoding them, if you enable the remote debug monitor.
However, the debug monitor cannot be used in a program which already RConsole as far as I'm aware.

spiked3 wrote:Is there even a way to set linker options in Eclipse? I haven't found them. And when I do, then what?


Go to the Eclipse preferences and enable verbose linking:
http://lejos.sourceforge.net/nxt/nxj/tu ... refs01.png
Make sure to update the plug-in to the one I just uploaded.

Verbose linking will show a list of classes and methods and the number assigned to them. That way, you can decode which exception happened and in which method it happened, which method that method was called from etc.

spiked3 wrote:I love what you guys did with LeJOS (remember I even tried to copy it to C# one time but the regulator thread differences between Java and C# got too complicated for me and I gave up). But I wish the development experience was more in line with android, which is also a separate remote jvm.


Are you being serious!? Android is a project heavily pushed by a big company called Google. leJOS is an entirely community driven project. And the number of core developers, spending their free time on leJOS, is so low, you barely need the fingers of your second hand to count them. Also, a modern Smartphone and the NXT are two completely different platforms, which differ in so many way - you're really comparing apples and bananas here.
The good news is, that a remote debugger based on JWDP has just been merged upstream. However, I can't tell you when IDE support will be available.
skoehler
leJOS Team Member
 
Posts: 1422
Joined: Thu Oct 30, 2008 4:54 pm

Re: RConsole.openAny(x) never times out

Postby spiked3 » Tue Feb 14, 2012 12:27 am

Yes, I am serious, I do not use punch card machines or command lines. If I did, I would run linux. I know many do, good for them, not for me, been there done that, NEVER going back. Most of you were probably in diapers in my command line days :) I'm too old for that now, I can barely remember where I left my reading glasses, never mind a cryptic command line.

I was just getting ready to be sure I had the latest plugin, glad to hear a new one is available. I had tried those 'enable verbose' options, but I saw nothing different as a result. I also tried the remote debugging monitor, but haven't had luck yet. Maybe I will with new plugin? There seems to be some timing order, as to when to run what and try to connect who - that usually lead to a locked brick I have to take the batteries out of.

I said "I wished the the development experience was more like android" not that I expected it to be. You guys do great for a small audience. Given time, I'm sure it is on everyone's wish list, no? Please do not take anything I say as a criticism, I am in awe of the work that's been done and freely distributed. It just does not fit ME, and again, somewhat from health issues. I don't expect my case to be typical.

At the moment, the page pointed to by the plugin anouncement (http://lejos.sourceforge.net/tools/eclipse/plugin/nxj/) pops up a dialog 'document can not be loaded by browser'
Last edited by spiked3 on Tue Feb 14, 2012 12:39 am, edited 1 time in total.
spiked3
New User
 
Posts: 18
Joined: Tue Feb 01, 2011 3:20 am
Location: east TN, US

Re: RConsole.openAny(x) never times out

Postby skoehler » Tue Feb 14, 2012 12:37 am

spiked3 wrote:Yes, I am serious, I do not use punch card machines or command lines. If I did, I would run linux. I know many do, good for them, not for me, been there done that, NEVER going back.

Very problematic attitude. Not the part where you say, that graphical user interfaces are desirable. The part where you refuse to use anything else is indeed problematic.

spiked3 wrote:Given time, I'm sure it is on everyone's wish list, no?

It certainly is ...
skoehler
leJOS Team Member
 
Posts: 1422
Joined: Thu Oct 30, 2008 4:54 pm

Re: RConsole.openAny(x) never times out

Postby spiked3 » Tue Feb 14, 2012 12:40 am

skoehler wrote:Very problematic attitude. Not the part where you say, that graphical user interfaces are desirable. The part where you refuse to use anything else is indeed problematic.


I'll let my neurologist know you are unhappy with my condition.
spiked3
New User
 
Posts: 18
Joined: Tue Feb 01, 2011 3:20 am
Location: east TN, US

Re: RConsole.openAny(x) never times out

Postby spiked3 » Tue Feb 14, 2012 1:33 am

Andy, FYI, found where I saw 'seconds';

http://lejos.sourceforge.net/nxt/nxj/tu ... ugging.htm
section: Remote Debugging
"If you use the variant of open with a timeout, it waits the specified number of seconds and if the debug monitor has not connected, proceeds without debugging. If the timeout is zero, it waits indefinitely."

Also, I try running my NXJ program via eclipse (debug with verbose options on), running nxjmonitor.bat via GUI, then connecting to the brick, leads to

BlueCove version 2.1.0 on winsock
unable to read reply packet length
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at lejos.pc.tools.NXJMonitor.actionPerformed(NXJMonitor.java:211)
at javax.swing.Timer.fireActionPerformed(Timer.java:312)
at javax.swing.Timer$DoPostEvent.run(Timer.java:244)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
-------------------------------
Is this just the result of running as not intended?
spiked3
New User
 
Posts: 18
Joined: Tue Feb 01, 2011 3:20 am
Location: east TN, US

Re: RConsole.openAny(x) never times out

Postby spiked3 » Tue Feb 14, 2012 2:39 am

I'm done, thanks for the help.
spiked3
New User
 
Posts: 18
Joined: Tue Feb 01, 2011 3:20 am
Location: east TN, US

Re: RConsole.openAny(x) never times out

Postby skoehler » Tue Feb 14, 2012 9:20 am

spiked3 wrote:Also, I try running my NXJ program via eclipse (debug with verbose options on), running nxjmonitor.bat via GUI, then connecting to the brick, leads to

BlueCove version 2.1.0 on winsock
unable to read reply packet length
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at lejos.pc.tools.NXJMonitor.actionPerformed(NXJMonitor.java:211)


That's most likely a consequence of NXJMonitor connecting to a NXT not running an LCP responder but RConsole instead.
Someday, that will be fixed as well and there will be a nice "cannot connect to NXT" message.
skoehler
leJOS Team Member
 
Posts: 1422
Joined: Thu Oct 30, 2008 4:54 pm


Return to NXJ Software

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests

more stuff