|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkoala.Koala
public class Koala
Class used to control Koala functionality either from the Korebot, using JNI
and libjkoala.so
, or from any platform using a direct serial connection
(for which the RXTX library is required). Most methods
are synchronised to prevent multiple threads interleaving commands to the Koala.
Field Summary | |
---|---|
int |
WHEELRADIUS
|
Method Summary | |
---|---|
void |
disconnect()
Disconnect from the Koala hardware. |
protected void |
finalize()
|
double |
getAngularVelocity()
Compute the angular velocity based on the current wheel speeds, in degrees per second. |
int |
getBatteryCharge()
Get the battery's charge in mAh. |
int |
getBatteryTemperature()
Get the battery's temperature in degrees Celcius. |
int |
getBatteryTimeLeft()
Estimate the time left (in minutes) before the battery is exhausted, based on the consumption current and the battery charge. |
int |
getBatteryVoltage()
Get the battery's voltage in mV. |
int |
getConsumptionCurrent()
Get the consumption current in mA. |
static Koala |
getInstance()
Get a reference to the robot. |
static Koala |
getInstance(java.lang.String comPort)
Get a reference to the robot. |
int |
getLeftMotorCurrent()
Get the consumption current of the left motor in mA. |
int |
getLeftMotorPosition()
Get the current position of the left motor. |
int |
getLeftMotorSpeed()
Get the left motor's speed. |
double |
getRadiusOfRotation()
Get the radius of the curve the robot is currently moving along, in millimetres. |
int |
getRightMotorCurrent()
Get the consumption current of the right motor in mA. |
int |
getRightMotorPosition()
Get the current position of the right motor. |
int |
getRightMotorSpeed()
Get the right motor's speed. |
java.lang.String |
getSoftwareVersion()
Request the Koala's OS and protocol version. |
int |
getTemperature()
Get the robot's ambient temperature in degrees Celcius. |
boolean |
hasLongRangeSensors()
Determine if this Koala has long-range proximity sensors. |
boolean |
isInitialised()
Check the robot is initialised. |
boolean |
leftMotorError()
Returns true if the motion controller reports a speed or position error on the left motor. |
int |
moveForward(double distance)
Move forward the specified distance of mm. |
void |
printFP(double x)
Prints a double to the standard output. |
KoalaSensorReading |
readAmbientSensors()
Read the 16 infra-red ambient light sensors. |
int |
readAnalogueInput(int channel)
Read one of the analogue inputs. |
int |
readDigitalInput(int channel)
Read one of the digital inputs. |
int |
readFrontLeftLRSensor()
Read the front left long-range proximity sensor. |
int |
readFrontRightLRSensor()
Read the front right long-range proximity sensor. |
int |
readLeftSideLRSensor()
Read the left side long-range proximity sensor. |
KoalaSensorReading |
readLongRangeSensors()
Read the long-range infra-red proximity sensors. |
KoalaSensorReading |
readProximitySensors()
Read the 16 infra-red proximity (reflected light) sensors. |
int |
readRightSideLRSensor()
Read the right side long-range proximity sensor. |
boolean |
rightMotorError()
Returns true if the motion controller reports a speed or position error on the right motor. |
int |
rotate(double angle)
Rotate (on the spot) by the specified angle in degrees. |
void |
rotate(int radius,
double angle)
Move along an arc specified by the radius (millimetres) and angle (degrees). |
int |
setDigitalOutput(int channel,
int state)
Set one of the digital outputs. |
int |
setLEDState(int ledNumber,
int state)
Change the state of an LED. |
int |
setMotorPosition(int left,
int right)
Set the position of the motors (their rotational position). |
void |
setSpeed(int radius,
double angularVelocity)
Set the wheel speeds given a radius (millimetres) and a desired angular velocity (degrees per second). |
int |
setSpeed(int left,
int right)
Set the motor speed. |
int |
turnLEDOff(int ledNumber)
Turn an LED off. |
int |
turnLEDOn(int ledNumber)
Turn an LED on. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final int WHEELRADIUS
Method Detail |
---|
public static Koala getInstance()
libjkoala.so
.
public static Koala getInstance(java.lang.String comPort)
comPort
- this is the name of the serial port (eg. "COM1") to connect to the Koala hardwarepublic boolean isInitialised()
public void disconnect()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.String getSoftwareVersion()
getSoftwareVersion
in interface KoalaSensors
public int getTemperature()
getTemperature
in interface KoalaSensors
public int getBatteryTemperature()
getBatteryTemperature
in interface KoalaSensors
public int getBatteryCharge()
getBatteryCharge
in interface KoalaSensors
public int getBatteryTimeLeft()
getBatteryTimeLeft
in interface KoalaSensors
public int getBatteryVoltage()
getBatteryVoltage
in interface KoalaSensors
public int getConsumptionCurrent()
getConsumptionCurrent
in interface KoalaSensors
public int getLeftMotorCurrent()
getLeftMotorCurrent
in interface KoalaMotors
public int getRightMotorCurrent()
getRightMotorCurrent
in interface KoalaMotors
public int setLEDState(int ledNumber, int state)
setLEDState
in interface KoalaSensors
public int turnLEDOn(int ledNumber)
turnLEDOn
in interface KoalaSensors
public int turnLEDOff(int ledNumber)
turnLEDOff
in interface KoalaSensors
public int setSpeed(int left, int right)
setSpeed
in interface KoalaMotors
public int getLeftMotorSpeed()
getLeftMotorSpeed
in interface KoalaMotors
public int getRightMotorSpeed()
getRightMotorSpeed
in interface KoalaMotors
public int setMotorPosition(int left, int right)
setMotorPosition
in interface KoalaMotors
setMotorPosition
in interface KoalaSensors
public int getLeftMotorPosition()
getLeftMotorPosition
in interface KoalaMotors
public int getRightMotorPosition()
getRightMotorPosition
in interface KoalaMotors
public int readAnalogueInput(int channel)
readAnalogueInput
in interface KoalaSensors
public int readDigitalInput(int channel)
readDigitalInput
in interface KoalaSensors
public int setDigitalOutput(int channel, int state)
setDigitalOutput
in interface KoalaSensors
public KoalaSensorReading readProximitySensors()
readProximitySensors
in interface KoalaSensors
public KoalaSensorReading readAmbientSensors()
readAmbientSensors
in interface KoalaSensors
public boolean leftMotorError()
leftMotorError
in interface KoalaMotors
public boolean rightMotorError()
rightMotorError
in interface KoalaMotors
public int moveForward(double distance)
moveForward
in interface KoalaMotors
public int rotate(double angle)
rotate
in interface KoalaMotors
public void rotate(int radius, double angle)
public void setSpeed(int radius, double angularVelocity)
public double getAngularVelocity()
public void printFP(double x)
public double getRadiusOfRotation()
public KoalaSensorReading readLongRangeSensors()
readLongRangeSensors
in interface KoalaLongRangeSensors
public int readFrontLeftLRSensor()
readFrontLeftLRSensor
in interface KoalaLongRangeSensors
public int readFrontRightLRSensor()
readFrontRightLRSensor
in interface KoalaLongRangeSensors
public int readLeftSideLRSensor()
readLeftSideLRSensor
in interface KoalaLongRangeSensors
public int readRightSideLRSensor()
readRightSideLRSensor
in interface KoalaLongRangeSensors
public boolean hasLongRangeSensors()
hasLongRangeSensors
in interface KoalaLongRangeSensors
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |