Crashing during program upload.

This is the place to ask question about Enchanting, talk about your Enchanting projects or simply find out more about Enchanting on the NXT.

Moderator: clintonb

Crashing during program upload.

Postby bradh » Tue Jan 14, 2014 1:46 am

We are experiencing intermittant crashing when we begin the upload of a project to our NXT. Sometimes it works, but mostly the upload hangs at the "Exporting Media and Code" Dialog box.

I have tried it with both OpenJDK and Sun JAVA. I do not experience any problems when uploading LeJOS .java files.

Running on Ubuntu 12.04. Enchanting 0.2.4.1.

Output from the terminal:

admin@isaac-N310:/opt/leJOS_NXJ/build$ enchanting
Enchanting Messenger is attempting to (re-)connect.
Scratch Messenger is attempting to (re-)connect.
NXT Messenger is attempting to (re-)connect.
Running Command = { "/usr/bin/enchanting-frontend" }
Trying to connect to NXT
Found NXT: MegaIZ 0016530CD088
Connected to NXT
NXT Messenger is listening for messages.
lostConnection(false): Started receivingMessages()
NXT Messenger asks for dispatch of: narrowcast "Connection status: true true"
NXT started receiving messages
Firmware version: 1.3
Firmware protocol: 1.2
Firmware status: 0
leJOS Firmware version: 0.9.1(6595)
Enchanting Messenger is listening for messages.
Incorrectly formatted message: 'send-vars'
Enchanting Messenger asks for dispatch of: send-vars
Received message: null value = null
Enchanting Messenger asks for dispatch of: sensor-update "value" 9.0
Received message: value value = 9.0
Sending variable update:value 9.0
Enchanting Messenger asks for dispatch of: narrowcast "Connection status?"
Received message: Connection status? value = null
NXT Messenger asks for dispatch of: narrowcast "Connection status: true true"
Enchanting Messenger asks for dispatch of: narrowcast "NXT Command: stop-program"
Received message: NXT Command: stop-program value = null
Received NXT command: [stop-program]
Stopping program
lostConnection(true): Stopped program; connection lost.
NXT Messenger asks for dispatch of: narrowcast "Connection status: false false"
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x001d8f46, pid=3648, tid=3030358848
#
# JRE version: 6.0_27-b27
# Java VM: OpenJDK Client VM (20.0-b12 mixed mode, sharing linux-x86 )
# Derivative: IcedTea6 1.12.6
# Distribution: Ubuntu 12.04 LTS, package 6b27-1.12.6-1ubuntu0.12.04.4
# Problematic frame:
# C [libusb-0.1.so.4+0x2f46] usb_fetch_and_parse_descriptors+0x706
#
# An error report file with more information is saved as:
# /tmp/hs_err_pid3648.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
/usr/share/enchanting/ThirdParty/lejos_nxj/bin/nxjpc: line 108: 3648 Aborted (core dumped) "$JAVA" $NXJ_FORCE32 -Dnxj.home="$NXJ_HOME" -classpath "$NXJ_CMDLINE_CP" "${NXJ_CMDLINE[@]}"
bradh
New User
 
Posts: 5
Joined: Tue Jan 14, 2014 1:33 am

Re: Crashing during program upload.

Postby clintonb » Sun Jan 26, 2014 2:14 am

Towards the end of the data you pasted (thanks!), it shows which JVM was in use. When you change JVMs, does it actually change there?

I'm assuming you already have lejos installed elsewhere on your computer. Perhaps you want to change BackEnd/set_env.sh (or /usr/share/enchanting/BackEnd/set_env.sh) and have it use your existing leJOS.

Please let me know if that helps.

Clinton
clintonb
Active User
 
Posts: 118
Joined: Fri May 28, 2010 1:44 am
Location: Cardston, Alberta, Canada

Re: Crashing during program upload.

Postby bradh » Mon Jan 27, 2014 4:33 am

Yes - It does change based on which JAVA I am using.

I also removed JAVA, enchanting, and LeJOS. I reinstalled all (with only one JVM on the machine). Same issue still.

I also tried changing the BackEnd to point to the LeJOS installation and I get the same messages. The last line does update to reflect the change in the LeJOS.

Any other ideas? Version imcompatability? I am happy to troubleshoot any ideas.
bradh
New User
 
Posts: 5
Joined: Tue Jan 14, 2014 1:33 am

Re: Crashing during program upload.

Postby bradh » Sat Feb 01, 2014 7:49 pm

I'm still trying to get a work around. One idea I had was to use Enchanting as just an IDE and then compile/link/deploy from the command line through leJOS (I think that is reasonable for a kid). I have tried the "Export Code..." under the file menu and created a .java file. I have tried compiling it, but no success. Is this possible and is their a documented process for doing it?
bradh
New User
 
Posts: 5
Joined: Tue Jan 14, 2014 1:33 am

Re: Crashing during program upload.

Postby clintonb » Tue Feb 04, 2014 3:59 am

bradh wrote:I'm still trying to get a work around. One idea I had was to use Enchanting as just an IDE and then compile/link/deploy from the command line through leJOS (I think that is reasonable for a kid). I have tried the "Export Code..." under the file menu and created a .java file. I have tried compiling it, but no success. Is this possible and is their a documented process for doing it?


That is an interesting idea.

It used to be simpler to do that, but then I put a refactored Enchanting a put a bunch of things into a library. Let me see ....

At about line 356 of NXTMessenger.java, we have this:

Code: Select all
      // Compile the file
      SaferExec se = new SaferExec(300);   // 5 minutes max time to compile
      System.getenv("NXJ_HOME");
      String result = se.execV(nxjc, "-cp", System.getenv("ENCHANTING_JAR"), sourceFile.getPath());
      //System.out.println("Result: *" + result + "*");


If you are willing to get the source and build it (take a look at the 'dev' pages on the Enchanting site, and give me a shout if you get stuck), you should be able to print out which command is generated. I think it is something like this:

Code: Select all
nxjc -cp /path/to/enchanting/OnDevice/enchanting.jar /path/to/your/file/export.java


(I'm thinking Enchanting might be in /usr/share/enchanting).

Oh, and then you'll need to link the file.

Code: Select all
      File nxjFile = new File(sourceFile.getParent(), classname + ".nxj");
      result = se.execV(nxjlink, "-cp",
         sourceFile.getParent() + File.pathSeparator + System.getenv("ENCHANTING_JAR"),
         "-o", nxjFile.getPath(), classname);


That is something like:

Code: Select all
nxjlink -cp /path/to/your/file/;/path/to/enchanting/OnDevice/enchanting.jar -o /path/to/your/file/export.nxj export


Darn, my code doesn't upload through the command line (and I'm not going to dig deeper tonight). I seem to recall that you can compile, link, and upload in one command, but I'd need to review the leJOS documentation or man pages.

Hope that helps, and sorry you are having difficulties. I'm afraid as much as I want the program to run flawlessly, I haven't made the time to test with Linux much.
clintonb
Active User
 
Posts: 118
Joined: Fri May 28, 2010 1:44 am
Location: Cardston, Alberta, Canada

Re: Crashing during program upload.

Postby bradh » Wed Feb 05, 2014 4:29 pm

Thanks. I will give it a try in the next couple of days and get back to you.

Brad
bradh
New User
 
Posts: 5
Joined: Tue Jan 14, 2014 1:33 am

Re: Crashing during program upload.

Postby bradh » Mon Feb 17, 2014 2:41 am

I was able to figure out a work around to allow for compiling/linking/depolying .java files when File> Export Code is used in enchanting:

1) Using the info you gave me on NXTMessanger I was able to go in and uncomment the output line for the compile/link/upload command. My NXTMessanger file file was located at: /home/bradh/development/enchanting/enchanting-trunk/BackEnd/NXTMessenger.java. I uncommented the line you mention above and rebuilt enchanting by running the rebuild command (using sudo) in /home/bradh/development/enchanting/enchanting-trunk

My command was:
Code: Select all
nxjc -cp  /home/bradh/development/enchanting/enchanting-trunk/OnDevice/NXT/enchanting.jar  /home/bradh/Enchanting.java
nxjlink -cp /home/bradh/:/home/bradh/development/enchanting/enchanting-trunk/OnDevice/NXT/enchanting.jar -o /home/bradh/Enchanting.nxj Enchanting
nxjupload -r Enchanting.nxj


2) Because Enchanting has ahold of the NXT when enchanting is open, the above command is not succesful because the NXT is in use. So I needed to stop enchanting from making a connection by modifying the NXTMessenger.java. On line 62 in just following public void connect() {, I changed:
From: boolean connected = false;
To: boolean connected = true;
I then rebuilt enchanting again.

To make this easy for the kiddo, I put the command above in a shell script (replacing /home/bradh/ with ./ in the above command), made it executable, and put it in the directory where enchanting's .java files are exported when a user chooses file export.

It's pretty easy to have a kid run the script after exporting the file, but do you have any tips on how I could add or modify a button in the GUI to perform the export and run the script?
bradh
New User
 
Posts: 5
Joined: Tue Jan 14, 2014 1:33 am

Re: Crashing during program upload.

Postby clintonb » Thu Mar 20, 2014 2:25 am

Hi bradh.

When you hit the green flag, the code is exported, and then a message is passed to the back end saying this has happened, at which point it is linked and uploaded and run.

I'd suggest breaking in there, in the back end code, and getting it to call your script, and see if that does what you need it to do.

Clinton
clintonb
Active User
 
Posts: 118
Joined: Fri May 28, 2010 1:44 am
Location: Cardston, Alberta, Canada

Re: Crashing during program upload.

Postby willemsn » Sat Mar 22, 2014 9:36 pm

bradh:

Just a note. I've been experiencing this as well. If I have some time in the coming weeks, I plan to look into why this is occurring.

However, in the meantime, I have a proposed fix. While USB has not worked for me, Bluetooth has worked well so far. While Bluetooth is slower, it has been working in my Xubuntu 13.10 system with Enchanting and NXT robots.
willemsn
New User
 
Posts: 1
Joined: Sat Mar 22, 2014 9:01 pm


Return to Enchanting Questions and Projects

Who is online

Users browsing this forum: No registered users and 0 guests

cron
more stuff