|
||||||||
| 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.Objectjava.lang.Throwablepublic java.lang.String getSoftwareVersion()
getSoftwareVersion in interface KoalaSensorspublic int getTemperature()
getTemperature in interface KoalaSensorspublic int getBatteryTemperature()
getBatteryTemperature in interface KoalaSensorspublic int getBatteryCharge()
getBatteryCharge in interface KoalaSensorspublic int getBatteryTimeLeft()
getBatteryTimeLeft in interface KoalaSensorspublic int getBatteryVoltage()
getBatteryVoltage in interface KoalaSensorspublic int getConsumptionCurrent()
getConsumptionCurrent in interface KoalaSensorspublic int getLeftMotorCurrent()
getLeftMotorCurrent in interface KoalaMotorspublic int getRightMotorCurrent()
getRightMotorCurrent in interface KoalaMotors
public int setLEDState(int ledNumber,
int state)
setLEDState in interface KoalaSensorspublic int turnLEDOn(int ledNumber)
turnLEDOn in interface KoalaSensorspublic int turnLEDOff(int ledNumber)
turnLEDOff in interface KoalaSensors
public int setSpeed(int left,
int right)
setSpeed in interface KoalaMotorspublic int getLeftMotorSpeed()
getLeftMotorSpeed in interface KoalaMotorspublic int getRightMotorSpeed()
getRightMotorSpeed in interface KoalaMotors
public int setMotorPosition(int left,
int right)
setMotorPosition in interface KoalaMotorssetMotorPosition in interface KoalaSensorspublic int getLeftMotorPosition()
getLeftMotorPosition in interface KoalaMotorspublic int getRightMotorPosition()
getRightMotorPosition in interface KoalaMotorspublic int readAnalogueInput(int channel)
readAnalogueInput in interface KoalaSensorspublic int readDigitalInput(int channel)
readDigitalInput in interface KoalaSensors
public int setDigitalOutput(int channel,
int state)
setDigitalOutput in interface KoalaSensorspublic KoalaSensorReading readProximitySensors()
readProximitySensors in interface KoalaSensorspublic KoalaSensorReading readAmbientSensors()
readAmbientSensors in interface KoalaSensorspublic boolean leftMotorError()
leftMotorError in interface KoalaMotorspublic boolean rightMotorError()
rightMotorError in interface KoalaMotorspublic int moveForward(double distance)
moveForward in interface KoalaMotorspublic 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 KoalaLongRangeSensorspublic int readFrontLeftLRSensor()
readFrontLeftLRSensor in interface KoalaLongRangeSensorspublic int readFrontRightLRSensor()
readFrontRightLRSensor in interface KoalaLongRangeSensorspublic int readLeftSideLRSensor()
readLeftSideLRSensor in interface KoalaLongRangeSensorspublic int readRightSideLRSensor()
readRightSideLRSensor in interface KoalaLongRangeSensorspublic boolean hasLongRangeSensors()
hasLongRangeSensors in interface KoalaLongRangeSensors
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||