|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--EDU.cmu.cs.coral.cye.JCyeComm
Handles all of the communication between the JCyeSrv class and the Cye robot. Thread is extended, to enable the CyeComm object to run in the background and poll the robot at a set frequency. If you are creating an instance of this class manually in your code, you are almost certainly doing something wrong. This class should only be created as a side effect of instantiating a JCyeSrv object.
Thread
,
JCyeSrv
,
JCyeMsg
,
JCyeStatus
Field Summary | |
static byte |
BLACK_ROBOT
Indicates the connection is to a newer black robot; |
static byte |
CHROME_ROBOT
Indicates the connection is to a newer chrom robot; |
static int |
NEW_RADIO
Indicates the connection is via new radio (must send a bunch of padding chars). |
static int |
OLD_RADIO
Indicates the connection is via old radio (must wait for warm up). |
static byte |
ORANGE_ROBOT
Indicates the connection is to a newer orange robot; |
static byte |
ORIGINAL_ROBOT
Indicates the connection is to an original robot. |
static int |
WIRED
Indicates the connection to the robot is wired (no radio warm up reqd). |
static byte |
YELLOW_ROBOT
Indicates the connection is to a newer yellow robot; |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY |
Constructor Summary | |
protected |
JCyeComm(java.lang.String d,
int b,
int c,
byte i)
The constructor for class JCyeComm. |
Method Summary | |
protected void |
ClearObstacle()
Resets the obstacle detector. |
protected double |
GetLastB()
Returns the last reported battery voltage of el roboto. |
protected int |
GetLastH()
Returns the last reported heading of el roboto. |
protected int |
GetLastX()
Returns the last reported X position of el roboto. |
protected int |
GetLastY()
Returns the last reported Y position of el roboto. |
protected boolean |
GetObstacle()
Returns the status of the obstacle detector. |
void |
run()
The background run method for
JCyeComm . |
protected JCyeMsg |
SendMsg(JCyeMsg Msg)
Sends a message (represented as an object of class JCyeMsg ) to the Cye robot, and waits
for an acknowledgement or retry failure. |
Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
setContextClassLoader,
setDaemon,
setName,
setPriority,
sleep,
sleep,
start,
stop,
stop,
suspend,
toString,
yield |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int WIRED
public static final int OLD_RADIO
public static final int NEW_RADIO
public static final byte ORIGINAL_ROBOT
public static final byte BLACK_ROBOT
public static final byte ORANGE_ROBOT
public static final byte YELLOW_ROBOT
public static final byte CHROME_ROBOT
Constructor Detail |
protected JCyeComm(java.lang.String d, int b, int c, byte i) throws JCyeException
JCyeComm.
Initializes the serial port driver, then carries
out the ISTART/ASTART sequence to initialize the robot.
- Parameters:
d
- the name of the serial device to open.b
- baud rate (9600 or 19200).c
- connection type (WIRED or OLD_RADIO or NEW_RADIO).i
- ID number.
Method Detail |
protected JCyeMsg SendMsg(JCyeMsg Msg)
JCyeMsg
) to the Cye robot, and waits
for an acknowledgement or retry failure.Msg
- the JCyeMsg
to send to the robot.JCyeMsg
.public void run()
run
method for
JCyeComm
. This method polls the
robot (with a CMD_POLL_REQUEST
message,
then goes back to sleep for SLEEP_TIME
ms.protected int GetLastX()
protected int GetLastY()
protected int GetLastH()
protected double GetLastB()
protected boolean GetObstacle()
ClearObstacle
,
return true.protected void ClearObstacle()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |