|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--SerialConnection | +--Bird
A class to handle state information for each bird. Birds can either have their own serial lines to the host, or they may send all their data through master.
Some assumptions about use:
We assume that the flock is being controlled by the master, and that all serial communications
come through the master. Each bird may manage it's own data, but when in flock mode, all of the
communication goes through the master bird.
Data rates: We calculated the size of the data using the following assumptions.
Field Summary | |
private boolean |
active
Field indicates that the bird is actively part of the flock. |
private int |
addr
This is the bird's address within the flock and follows the addreses set on the dipswitches on the back of the flock of birds hardware. |
private boolean |
angleAlign2Changed
Indicates that the ANGLE ALIGN2 parameters have been set |
private float[] |
angles
This stores the last reported ANGLES measurement |
static int |
ANGLES_NUM_BYTES
The number of bytes in an angles record |
static java.lang.String |
anglesData
Type of data that may be coming from the bird. |
static java.lang.String |
axisAngleData
Type of data that may be coming from the bird. |
private java.lang.String |
currentDataType
Indicates the type of data that the bird is currently processing |
static java.lang.String |
examineData
Type of data that may be coming from the bird. |
private Flock |
flock
A reference to the flock this bird belongs to. |
private boolean |
isMaster
Field indicates if this bird is a flock master. |
static java.lang.String |
matrixData
Type of data that may be coming from the bird. |
private int |
measurementRate
The measurement rate in cyles/sec |
private java.lang.String |
portName
The port where the bird serial connection is. |
static java.lang.String |
positionData
Type of data that may be coming from the bird. |
static java.lang.String |
positionMatrixData
Type of data that may be coming from the bird. |
private static int |
QUATERNION_NUM_BYTES
The number of bytes in a quaternion record |
static java.lang.String |
quaternionData
Type of data that may be coming from the bird. |
private boolean |
streaming
Indicates that the bird is in the streaming mode |
Fields inherited from class SerialConnection |
appName, baudRate, inStream, listener, open, outStream, portId, portList, serialPort, timeout |
Constructor Summary | |
Bird(Flock fl,
boolean master,
int addr,
java.lang.String port,
boolean active)
Create a bird at the specified address and the specified port name. |
Method Summary | |
void |
connect()
Open the serial connection. |
float[] |
getAngles()
Get the last set orientation of the Bird in ANGLES mode. |
java.lang.String |
getDataType()
Get the current data type |
boolean |
isAngleAlign2Changed()
Find out if Angle Align2 was set. |
boolean |
isConnected()
Says whether or not this bird is connected. |
static int |
recordSizeOfDataType(java.lang.String type)
Returns the record size of the given dataType. |
void |
setActive(boolean fl)
Sets the active flag. |
void |
setAngleAlign2Changed()
Set the angle align2 change to true. |
void |
setAngles(float[] a)
Set the orientation of the Bird in ANGLES mode. |
void |
setDataType(java.lang.String type)
Sets the data type |
void |
setMeasurementRate(int r)
This should correspond to the measurement rate that the bird has been set to. |
void |
setStreaming(boolean b)
Used by the flock to tell the bird that it is in streaming mode. |
Methods inherited from class SerialConnection |
closeConnection, getSerialConectionListener, isOpen, openConnection, serialEvent, setSerialConnectionListener, writeByte, writeByte |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.lang.String portName
private int addr
private float[] angles
private Flock flock
private boolean isMaster
true
if
this is a master; false
if this is a slaveprivate boolean active
private boolean streaming
private java.lang.String currentDataType
private boolean angleAlign2Changed
private int measurementRate
public static final java.lang.String matrixData
currentDataType
public static final java.lang.String positionData
currentDataType
public static final java.lang.String quaternionData
currentDataType
public static final java.lang.String positionMatrixData
currentDataType
public static final java.lang.String examineData
currentDataType
public static final java.lang.String axisAngleData
currentDataType
public static final java.lang.String anglesData
currentDataType
private static final int QUATERNION_NUM_BYTES
public static final int ANGLES_NUM_BYTES
Constructor Detail |
public Bird(Flock fl, boolean master, int addr, java.lang.String port, boolean active)
fl
- The flock class that this bird belongs to.master
- Indicates whether this is a master bird or a slave bird.addr
- is the address of this bird within the flockport
- is the name of the COM port this bird is communicating through.active
- indicates whether or not the bird is actively part of the flock.Method Detail |
public boolean isConnected()
public void connect()
public void setMeasurementRate(int r)
public void setStreaming(boolean b)
public void setAngles(float[] a)
public float[] getAngles()
public void setAngleAlign2Changed()
public boolean isAngleAlign2Changed()
public void setDataType(java.lang.String type)
public void setActive(boolean fl)
public java.lang.String getDataType()
public static int recordSizeOfDataType(java.lang.String type)
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |