This has been done with Python - see
http://www.surveyor.com/cgi-bin/yabb2/YaBB.pl?num=1175456528 I don't know of anyone working on neural nets with the SRV-1 in Java, but using neural nets in Java seems to be common -
*
http://fbim.fh-regensburg.de/~saj39122/jfroehl/diplom/e-index.html *
http://www.jeffheaton.com/ai *
http://www.ibm.com/developerworks/library/l-neural/ Basically, you just need to create a Java application that communicates with the serial port to send and receive SRV_protocol commands to the robot ( see protocol definition at
http://www.surveyor.com/SRV_protocol.html ) which gather sensor data and send motor commands. You'll probably want to use the RXTXcomm.jar library for serial communications. Here's some code for setting up the serial port -
private void openSerialPort()
{
Enumeration portList;
CommPortIdentifier portId;
if (comPort == null || "".equals (comPort)) {
error("no COM port specified");
}
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement ();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (comPort.equals(portId.getName ())) {
trace("opening " + portId.getName () + "...");
try {
serialPort =
(SerialPort) portId.open("SRV Console", 0);
}
catch (PortInUseException e) {
trace("RS232 port in use");
return;
}
setBps (115200);
try {
out = serialPort.getOutputStream();
is = new BufferedInputStream(serialPort.
getInputStream(), 16384);
} catch (IOException e2) {
error(e2.toString());
}
serialPort.setDTR(false);
serialPort.setRTS(false);
/*
try {
serialPort.addEventListener(this);
} catch (TooManyListenersException e) { }
serialPort.notifyOnDataAvailable(true);
*/
trace("connected to " + portId.getName ());
return;
}
}
}
}
private void closeSerialPort()
{
try {
if (out != null) out.close ();
if (is != null) is.close ();
if (serialPort != null) serialPort.close();
out = null;
is = null;
serialPort = null;
} catch (IOException ioe) {
trace ("Error closing SRV connection: " + ioe);
}
}
private boolean setBps(int bps)
{
boolean r = false;
try {
serialPort.setSerialPortParams (bps,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
r = true;
} catch (UnsupportedCommOperationException e3) {
error ("error configuring RS232 port");
e3.printStackTrace ();
}
return r;
}