Having problem with iCommand-0.6-preview

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

Moderators: 99jonathan, roger, imaqine

Having problem with iCommand-0.6-preview

Postby muimui » Thu Aug 09, 2007 1:00 am

I am trying the SpeechSynthesis program in the book with iCommand-0.6-preview and is having the following error:

Exception in thread "main" java.lang.NullPointerException
at icommand.nxt.comm.NXTCommand.openWrite(Unknown Source)
at icommand.nxt.FileSystem.upload(Unknown Source)
at SpeechSynthesis.say(SpeechSynthesis.java:27)
at SpeechSynthesis.main(SpeechSynthesis.java:43)

Please help

*******************************************
The SpeechSynthesis.java is listed below:

import icommand.nxt.*;
import icommand.nxt.comm.*;

import java.io.*;

public class SpeechSynthesis {
static File freettsdir = new File("C:/Lejos/freetts-1.2.1-bin/freetts-1.2.1");
static File converttool = new File("C:/Lejos/wavrsocvt/wavrsocvt.exe");

static String WAVNAME = "temp.wav";
static String RSONAME = "temp.rso";
public static void say(String sentence) {

String execString = "java -jar lib/freetts.jar -dumpAudio " + WAVNAME + " -text ";
try {
Process p = Runtime.getRuntime().exec(execString + sentence,null,freettsdir);
p.waitFor();
p = Runtime.getRuntime().exec(converttool + " " + WAVNAME + " -O=" + freettsdir,null,freettsdir);
p.waitFor();
} catch (Exception e) {
System.out.println("Exceptioon: " + e);
}
System.out.println("rsoFile is " + freettsdir + "\\" + RSONAME);
File rsoFile = new File(freettsdir + "\\" + RSONAME);
if (rsoFile == null)
System.out.println("RSO file not found");
byte status = FileSystem.upload(rsoFile);
if(status == 0)
System.out.println("File successfully uploaded");
else {
System.out.println("Error uploading " + rsoFile.getName() + ": " + Integer.toHexString(status));
return;
}
rsoFile.delete();
Sound.playSoundFile(rsoFile.getName());
NXTCommand.setVerify(true);
do {} while(FileSystem.delete(rsoFile.getName())!=0);
}

public static void main(String[] args) {
// NXTCommand.open();
System.out.println("Program started");
SpeechSynthesis.say("PLEASE PUT DOWN YOUR WEAPON");
SpeechSynthesis.say("YOU HAVE 20 SECONDS TO COMPLY");
SpeechSynthesis.say("YOU NOW HAVE 15 SECONDS TO COMPLY");
NXTCommand.close();
}
}
muimui
New User
 
Posts: 5
Joined: Mon Jul 02, 2007 10:32 pm

Postby Mike.H » Thu Aug 09, 2007 2:33 am

Would the problem lie in the MAIN method you have in your code? You have "NXTCommand.open();" commented out, but not the closing instruction at the bottom.
Mike.H
New User
 
Posts: 6
Joined: Wed Aug 01, 2007 1:07 am

Postby muimui » Thu Aug 09, 2007 6:02 am

Thanks for replying.
I have a similar error if I uncomment "NXTCommand.open();"

See below:

java.lang.NullPointerException
at icommand.nxt.comm.NXTCommBlueCove.stripColons(Unknown Source)
at icommand.nxt.comm.NXTCommBlueCove.open(Unknown Source)
at icommand.nxt.comm.NXTCommand.open(Unknown Source)
at SpeechSynthesis.main(SpeechSynthesis.java:41)

Process completed.
muimui
New User
 
Posts: 5
Joined: Mon Jul 02, 2007 10:32 pm

Postby ramso » Thu Aug 09, 2007 6:07 pm

Are you testing other more simply program with icommand?

If you are working in linux, try to change nxtcomm.type to bluez in the icommand.properties file. And copy the libicmdbluez.so to /usr/lib/jvm/java/jre/lib/i386

with this for me work fine
ramso
New User
 
Posts: 8
Joined: Thu Aug 09, 2007 5:41 pm
Location: Spain

Postby muimui » Thu Aug 09, 2007 9:22 pm

I am using windows and COM5 for bluetooth communication.

Is there anything wrong with my iCommand.properties settings?

# Set the value of the nxtcomm property to the value of ->your<- serial port,
# e.g. COM4 (on Windows), dev/tty.NXT_1 (on Mac OSX), /dev/rfcomm0 (on Linux)
nxtcomm=COM5

# Communication implementation type: rxtx, bluecove, bluez; defaults to rxtx.
# nxtcomm.type=bluecove
# The bluetooth address of ->your<- NXT, e.g. 00:16:53:01:EC:04
nxt.btaddress=00:16:53:02:06:D1

# Communication implementation type: rxtx, bluecove, bluez; defaults to rxtx.
# nxtcomm.type=bluez
# The bluetooth address of ->your<- NXT, e.g. 00:16:53:01:EC:04
# nxt.btaddress=00:16:53:02:06:D1
# or use:
# bluez.address=00:16:53:02:06:D1

# Communication implementation type: rxtx, bluecove, bluez; defaults to rxtx.
nxtcomm.type=rxtx
# The name of ->your<- serial port for bluetooth
rxtx.port=COM5
muimui
New User
 
Posts: 5
Joined: Mon Jul 02, 2007 10:32 pm

Postby ramso » Fri Aug 10, 2007 2:54 pm

The error message is related with the bluetooth connection. I think he trying to use the bluecove and not the rxt, comment
nxtcomm=COM5
and
nxt.btaddress=00:16:53:02:06:D1
. Run
Code: Select all
java -jar icommand
to validate the config. the result say your where is the config file and the port for use.
I don't work with win, but i think is equals of linux.
ramso
New User
 
Posts: 8
Joined: Thu Aug 09, 2007 5:41 pm
Location: Spain


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 7 guests

more stuff