public class Turntable extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
currentAngleTicks |
protected static double |
TICKS_PER_DEGREE |
protected static double |
TICKS_PER_RADIAN |
protected static int |
TICKS_PER_REVOLUTION |
protected SerialDevice |
turntableDevice |
Constructor and Description |
---|
Turntable(String port)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection to the turntable.
|
double |
getCurrentAngleDegrees()
Get the current absolute angle in degrees (relative to the position at
initialisation)
|
double |
getCurrentAngleRadians()
Get the current absolute angle in radians (relative to the position at
initialisation)
|
static void |
main(String[] args)
Test the turntable
|
void |
rotateByDegrees(double degrees)
Rotate the turntable by the given angle in degrees.
|
void |
rotateByRadians(double rads)
Rotate the turntable by the given angle in radians.
|
void |
rotateToDegrees(double degrees)
Rotate the turntable to the given absolute angle in degrees (relative to
the position at initialisation).
|
void |
rotateToRadians(double rads)
Rotate the turntable to the given absolute angle in radians (relative to
the position at initialisation).
|
protected void |
sendCommand(int ticks) |
protected void |
sendCommand(int ticks,
boolean cw) |
protected static final int TICKS_PER_REVOLUTION
protected static final double TICKS_PER_DEGREE
protected static final double TICKS_PER_RADIAN
protected int currentAngleTicks
protected SerialDevice turntableDevice
public double getCurrentAngleDegrees()
public double getCurrentAngleRadians()
public void rotateToRadians(double rads) throws IOException
rads
- the angle in radiansIOException
public void rotateToDegrees(double degrees) throws IOException
degrees
- the angle in degreesIOException
public void rotateByRadians(double rads) throws IOException
rads
- the angle in radiansIOException
public void rotateByDegrees(double degrees) throws IOException
degrees
- the angle in degreesIOException
protected void sendCommand(int ticks) throws IOException
IOException
protected void sendCommand(int ticks, boolean cw) throws IOException
IOException
public void close() throws IOException
IOException