|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnao.BasicNao
public class BasicNao
Wrapper class for accessing a Nao robot remotely using jnaoqi.jar version 1.12.5. The BasicNao abstracts the much of the core functionality (ignoring offline training tasks), while the ExtendedNao provides new functionality.
Constructor Summary | |
---|---|
BasicNao(java.lang.String ip,
int port)
Connect to a Nao robot at the specified IP address and port number. |
Method Summary | |
---|---|
void |
closeLeftHand()
Close the left hand (blocking method). |
void |
closeRightHand()
Close the right hand (blocking method). |
AccelerationVector |
getAcceleration()
Read the accelerometer to get the current acceleration (there is always acceleration due to gravity) in metres per second squared. |
java.util.List<java.lang.String> |
getAvailableRecognitionLanguages()
Get a list of the available speech recognition languages. |
java.util.List<java.lang.String> |
getAvailableSpeakingLanguages()
Get a list of the available speaking languages. |
double |
getBatteryLevel()
Get the battery charge level. |
CameraImage |
getCameraImage()
Retrieve a 640x480px RGB image from the camera. |
CameraImage |
getCameraImage(boolean topCamera)
Retrieve a 640x480px RGB image from the camera. |
NaoLocation |
getDeadReckonedLocation()
|
double |
getJointPosition(java.lang.String jointName)
Get the current angle of a joint (in radians). |
double |
getMotorTemperature(java.lang.String jointName)
Get the current temperature of a joint motor (in degrees Celcius). |
Pose |
getPose()
Get the current pose of the Nao, consisting of an angle for each joint (in radians). |
java.lang.String |
getPoseName()
Get the name of the Nao's current pose, if there is one. |
java.lang.String |
getRecognitionLanguage()
Get the current speech recognition (listening) language. |
java.lang.String |
getSpeakingLanguage()
Get the current speaking language. |
double |
getSpeed()
Get the speed in the X direction (forwards) in metres per second. |
Location |
getTrackedBallLocation()
Get the location relative to the Nao of the tracked ball, if one has been seen. |
Location |
getTrackedFaceLocation()
Get the location relative to the Nao of the tracked face, if one has been seen. |
boolean |
hasFallen()
|
DetectedBallInfo |
isBallDetected()
If a red ball has been detected, its location in the image is returned. |
DetectedFaceInfo |
isFaceDetected()
If a face has been detected, its location in the image is returned. |
boolean |
isHeadTouched()
Check if the head is being touched (by a human). |
java.util.List<DetectedLandmarkInfo> |
isLandmarkDetected()
If a landmark (naomark) has been detected, its number is returned. |
boolean |
isLeftHandClosed()
Check if the left hand is closed. |
boolean |
isLeftHandTouched()
Check if the left hand is being touched (by a human). |
boolean |
isLeftToeTouched()
Check if the left toe bumper is being pressed. |
java.lang.String |
isObjectDetected()
If a learned object has been detected, its name is returned. |
boolean |
isPowerSupplyConnected()
Check if the power supply cable is connected. |
boolean |
isRightHandClosed()
Check if the right hand is closed. |
boolean |
isRightHandTouched()
Check if the right hand is being touched (by a human). |
boolean |
isRightToeTouched()
Check if the right toe bumper is being pressed. |
SoundLocation |
isSoundDetected()
If a loud sound has been heard, its location relative to the Nao is returned. |
java.util.List<java.lang.String> |
isSpeechDetected()
If a recognised word has been heard, it is returned in the list. |
void |
moveJoint(java.lang.String jointName,
double angle)
Turns the specified joint to the given angle. |
void |
moveJoint(java.lang.String jointName,
double angle,
double speed)
Turns the specified joint to the given angle. |
void |
moveLeftHandTo(Location loc)
Move the left hand to the specified target location (using the whole left arm). |
void |
moveRightHandTo(Location loc)
Move the right hand to the specified target location (using the whole right arm). |
void |
openLeftHand()
Open the left hand (blocking method). |
void |
openRightHand()
Open the right hand (blocking method). |
void |
performMotion(BodyMotionFrameSet bodyMotion)
Performs motion (an 'animation') consisting of a set of target positions ('frames') for each joint. |
void |
playAudio(java.lang.String filename)
Play an audio recording. |
void |
playWebAudio(java.lang.String url)
Play an internet radio stream. |
double |
readLeftSonar()
Get the distance reading from the left sonar (in metres, up to 2.55m). |
double |
readRightSonar()
Get the distance reading from the right sonar (in metres, up to 2.55m). |
void |
say(java.lang.String phrase)
Use the text-to-speech engine to say a phrase. |
void |
send32BitsIR(byte b1,
byte b2,
byte b3,
byte b4)
Send 32 bits using the infra-red transmitter. |
void |
send8BitsIR(byte b)
Send 8 bits using the infra-red transmitter. |
void |
setChestLEDColour(int red,
int green,
int blue)
Set the colour (and brightness) of the chest LED. |
void |
setEarLEDBrightness(int level)
Set the brightness of the ear LEDs (0 to 255). |
void |
setEyeLEDColour(java.awt.Color c)
Set the colour (and brightness) of the eye LEDs. |
void |
setEyeLEDColour(int red,
int green,
int blue)
Set the colour (and brightness) of the eye LEDs. |
void |
setFeetLEDColour(int red,
int green,
int blue)
Set the colour (and brightness) of the feet LEDs. |
void |
setHeadLEDBrightness(int level)
Set the brightness of the LEDs on the top of the head (0 to 255). |
void |
setRecognitionLanguage(java.lang.String language)
Set the speech recognition (listening) language. |
void |
setSpeakingLanguage(java.lang.String language)
Set the language that the Nao speaks. |
void |
startBallDetection()
Enable red ball detection. |
void |
startBallTracking()
Enable red ball tracking. |
void |
startFaceDetection()
Enable face detection. |
void |
startFaceTracking()
Enable face tracking. |
void |
startLandmarkDetection()
Enable landmark (naomark) detection. |
void |
startObjectDetection()
Enable detection of previously learned objects. |
void |
startRecordingAudio(java.lang.String filename,
boolean oggCompressed)
Start recording audio to the specified file. |
void |
startSoundLocalisation()
Enable (loud) sound localisation. |
void |
startSpeechRecognition(java.util.List<java.lang.String> words)
Enable speech recognition. |
void |
startWalking(double speedX,
double speedY,
double speedTheta)
Start walking at a given speed. |
void |
stopAudioPlayback()
Stop all playback of recordings or an internet stream. |
void |
stopBallDetection()
Disable red ball detection. |
void |
stopBallTracking()
Disable red ball tracking. |
void |
stopFaceDetection()
Disable face detection. |
void |
stopFaceTracking()
Disable face tracking. |
void |
stopLandmarkDetection()
Disable landmark detection. |
void |
stopObjectDetection()
Disable object detection. |
void |
stopRecordingAudio()
Stop recording audio. |
void |
stopSoundLocalisation()
Disable sound localisation. |
void |
stopSpeechRecognition()
Disable speech recognition. |
void |
stopWalking()
Stop walking. |
void |
subscribeToEvents(NaoEventListener nel)
Subscribe to receive events for the touch sensors, or ball, face, object and speech detection. |
void |
turnChestLEDOff()
Turn the chest LED off. |
void |
turnEarLEDsOff()
Turn the ear LEDs off. |
void |
turnEyeLEDsOff()
Turn the eye LEDs off. |
void |
turnFeetLEDsOff()
Turn the feet LEDs off. |
void |
turnHeadLEDsOff()
Turn the head LEDs off. |
void |
walkFor(int milliseconds,
double speedX)
Walk for a certain length of time. |
void |
walkSteadilyTo(double x,
double y,
double theta)
Walk to a point relative to the Nao's current location, without using the arms, and ensuring maximum stability (useful when the Nao is carrying something). |
void |
walkTo(double x,
double y,
double theta)
Walk to a point relative to the Nao's current location. |
void |
walkTo(double x,
double y,
double theta,
boolean useLeftArm,
boolean useRightArm)
Walk to a point relative to the Nao's current location, optionally without using the arms. |
void |
walkTo(Location loc)
Walk to a point relative to the Nao's current location. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicNao(java.lang.String ip, int port) throws java.net.ConnectException
java.net.ConnectException
Method Detail |
---|
public void subscribeToEvents(NaoEventListener nel)
public void say(java.lang.String phrase)
public void setSpeakingLanguage(java.lang.String language)
public java.lang.String getSpeakingLanguage()
public java.util.List<java.lang.String> getAvailableSpeakingLanguages()
public java.lang.String getRecognitionLanguage()
public void setRecognitionLanguage(java.lang.String language)
public java.util.List<java.lang.String> getAvailableRecognitionLanguages()
public void startSpeechRecognition(java.util.List<java.lang.String> words)
words
- The list of words to listen for.public void stopSpeechRecognition()
public java.util.List<java.lang.String> isSpeechDetected()
public void startSoundLocalisation()
public void stopSoundLocalisation()
public SoundLocation isSoundDetected()
public void startRecordingAudio(java.lang.String filename, boolean oggCompressed)
filename
- The filename in which to store the audio (onboard the Nao).oggCompressed
- True if the audio should be compressed in OGG format.public void stopRecordingAudio()
public void playAudio(java.lang.String filename) throws java.io.FileNotFoundException
filename
- The filename (onboard the Nao) from which to play the audio.
java.io.FileNotFoundException
public void playWebAudio(java.lang.String url) throws java.net.ConnectException
url
- The URL of the radio stream.
java.net.ConnectException
public void stopAudioPlayback()
public void performMotion(BodyMotionFrameSet bodyMotion)
bodyMotion
- The set of frames to iterate throughpublic void moveJoint(java.lang.String jointName, double angle)
jointName
- The joint to moveangle
- The destination angle (in radians)public void moveJoint(java.lang.String jointName, double angle, double speed)
jointName
- The joint to moveangle
- The destination angle (in radians)speed
- The speed to move the joint at (between 0 and 1)public void walkTo(double x, double y, double theta)
x
- The distance forwards or backwards (in metres)y
- The distance left or right (in metres)theta
- The amount to turn (in radians)public void walkTo(Location loc)
loc
- The locationpublic void walkTo(double x, double y, double theta, boolean useLeftArm, boolean useRightArm)
x
- The distance forwards or backwards (in metres)y
- The distance left or right (in metres)theta
- The amount to turn (in radians)useLeftArm
- Use the left arm while walkinguseRightArm
- Use the right arm while walkingpublic void walkSteadilyTo(double x, double y, double theta)
x
- The distance forwards or backwards (in metres)y
- The distance left or right (in metres)theta
- The amount to turn (in radians)public void startWalking(double speedX, double speedY, double speedTheta)
speedX
- The speed in the X direction (forwards) (in metres per second)speedY
- The speed in the Y direction (sideways) (in metres per second)speedTheta
- The angular speed (in radians per second)public void stopWalking()
public void walkFor(int milliseconds, double speedX)
milliseconds
- The time to walk for (in milliseconds)speedX
- The speed in X (in metres per second)public double getSpeed()
public void openLeftHand()
public void openRightHand()
public void closeLeftHand()
public void closeRightHand()
public boolean isLeftHandClosed()
public boolean isRightHandClosed()
public void moveLeftHandTo(Location loc)
public void moveRightHandTo(Location loc)
public boolean hasFallen()
public CameraImage getCameraImage()
public CameraImage getCameraImage(boolean topCamera)
topCamera
- True to get the image from the top camera, false to get the image from the bottom camera.public void setEyeLEDColour(java.awt.Color c)
public void setEyeLEDColour(int red, int green, int blue)
public void turnEyeLEDsOff()
public void setChestLEDColour(int red, int green, int blue)
public void turnChestLEDOff()
public void setFeetLEDColour(int red, int green, int blue)
public void turnFeetLEDsOff()
public void setEarLEDBrightness(int level)
public void turnEarLEDsOff()
public void setHeadLEDBrightness(int level)
public void turnHeadLEDsOff()
public double getBatteryLevel()
public boolean isPowerSupplyConnected()
public java.lang.String getPoseName()
public Pose getPose()
public double getJointPosition(java.lang.String jointName)
public double getMotorTemperature(java.lang.String jointName)
public AccelerationVector getAcceleration()
public double readLeftSonar()
public double readRightSonar()
public boolean isLeftHandTouched()
public boolean isRightHandTouched()
public boolean isHeadTouched()
public boolean isLeftToeTouched()
public boolean isRightToeTouched()
public void send32BitsIR(byte b1, byte b2, byte b3, byte b4)
public void send8BitsIR(byte b)
public void startFaceDetection()
public void stopFaceDetection()
public DetectedFaceInfo isFaceDetected()
public void startBallDetection()
public void stopBallDetection()
public DetectedBallInfo isBallDetected()
public void startObjectDetection()
public void stopObjectDetection()
public java.lang.String isObjectDetected()
public void startLandmarkDetection()
public void stopLandmarkDetection()
public java.util.List<DetectedLandmarkInfo> isLandmarkDetected()
public void startBallTracking()
public void stopBallTracking()
public Location getTrackedBallLocation()
public void startFaceTracking()
public void stopFaceTracking()
public Location getTrackedFaceLocation()
public NaoLocation getDeadReckonedLocation()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |