|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectroombacomm.RoombaComm
roombacomm.RoombaCommSerial
public class RoombaCommSerial
The serial-port based implementation of RoombaComm. Handles both physical RS-232 ports, USB adapter ports like Keyspan USA-19HS, and Bluetooth serial port profiles.
Some code taken from processing.serial.Serial. Thanks guys!
| Field Summary | |
|---|---|
boolean |
flushOutput
RXTX bombs when flushing output sometimes, so by default do not flush the output stream. |
java.io.InputStream |
input
the serial input stream, normally you don't need access to this |
java.io.OutputStream |
output
the serial output stream, normally you don't need access to this |
gnu.io.SerialPort |
port
The RXTX port object, normally you don't need access to this |
static int |
updateSensorsPause
The time to wait in milliseconds after sending sensors command before attempting to read |
boolean |
waitForDSR
Some "virtual" serial ports like Bluetooth serial on Windows return weird errors deep inside RXTX if an opened port is used before the virtual COM port is ready. |
| Fields inherited from class roombacomm.RoombaComm |
|---|
debug, defaultSensorsUpdateTime, defaultSpeed, millimetersPerDegree, millimetersPerRadian, speed, VERSION, wheelbase |
| Constructor Summary | |
|---|---|
RoombaCommSerial()
|
|
RoombaCommSerial(boolean autoupdate)
|
|
RoombaCommSerial(boolean autoupdate,
int updateTime)
|
|
| Method Summary | |
|---|---|
void |
computeSensors()
called by serialEvent when we have enough bytes to make sensors valid |
boolean |
connect(java.lang.String portid)
Connect to a serial port specified by portid doesn't guarantee connection to Roomba, just to serial port |
void |
disconnect()
Disconnect from serial port |
static boolean |
isPortInUse(java.lang.String pname)
Let you check to see if a port is in use by another Rooomba before trying to use it. |
java.lang.String[] |
listPorts()
If this just hangs and never completes on Windows, it may be because the DLL doesn't have its exec bit set. |
boolean |
send(byte[] bytes)
subclassed. |
boolean |
send(int b)
This will handle both ints, bytes and chars transparently. |
void |
serialEvent(gnu.io.SerialPortEvent serialEvent)
callback for SerialPortEventListener (from processing.serial.Serial) |
boolean |
updateSensors()
Update sensors. |
void |
wakeup()
toggles DD line via serial port DTR (if available) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int updateSensorsPause
public gnu.io.SerialPort port
public java.io.InputStream input
public java.io.OutputStream output
public boolean flushOutput
public boolean waitForDSR
| Constructor Detail |
|---|
public RoombaCommSerial()
public RoombaCommSerial(boolean autoupdate)
public RoombaCommSerial(boolean autoupdate,
int updateTime)
| Method Detail |
|---|
public static boolean isPortInUse(java.lang.String pname)
public boolean connect(java.lang.String portid)
connect in class RoombaCommportid - name of port, e.g. "/dev/cu.KeySerial1" or "COM3"
public void disconnect()
disconnect in class RoombaCommpublic boolean send(byte[] bytes)
send in class RoombaCommbytes - byte array of SCI commands to send
public boolean send(int b)
send in class RoombaCommb - byte of an SCI command to send
public void wakeup()
wakeup in class RoombaCommpublic boolean updateSensors()
updateSensors in class RoombaCommpublic void computeSensors()
public java.lang.String[] listPorts()
listPorts in class RoombaCommpublic void serialEvent(gnu.io.SerialPortEvent serialEvent)
serialEvent in interface gnu.io.SerialPortEventListener
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||