public class NxtTurtleRobot extends LegoRobot
Modifier and Type | Field and Description |
---|---|
static double |
AxeLength |
static int |
connectionTimeout |
static int |
GearAcceleration |
static int |
GearBrakeDelay |
static int |
GearSpeed |
static java.lang.String |
IPAddress |
static int |
IPPort |
static int |
LightSensorPollDelay |
static int |
MotorSpeed |
static double |
MotorSpeedFactor |
static int |
SoundSensorPollDelay |
static int |
TouchSensorPollDelay |
static double |
TurtleRotationFactor |
static int |
TurtleRotationSpeed |
static int |
TurtleSpeed |
static double |
TurtleStepFactor |
static int |
UltrasonicSensorPollDelay |
Constructor and Description |
---|
NxtTurtleRobot(ConnectionListener listener)
Creates a NxtTurtleRobot and engage a connection trial.
|
NxtTurtleRobot(ConnectionListener listener,
java.lang.String ipAddress)
Creates a NxtTurtleRobot instance with given IP address.
|
NxtTurtleRobot(ConnectionListener listener,
java.lang.String ipAddress,
boolean immediateConnect)
Creates a NxtTurtleRobot instance with given IP address.
|
NxtTurtleRobot(ConnectionListener listener,
java.lang.String ipAddress,
int port,
boolean immediateConnect)
Creates a NxtTurtleRobot instance with given IP address.
|
Modifier and Type | Method and Description |
---|---|
NxtTurtleRobot |
backward(int steps)
Moves the turtle backward the given number of steps.
|
void |
exit()
Closes the communication and terminates the program.
|
NxtTurtleRobot |
forward(int steps)
Moves the turtle forward the given number of steps.
|
NxtGear |
getGear()
Returns the gear used as component of the turtle.
|
int |
getTurtleSpeed()
Returns the current turtle speed.
|
NxtTurtleRobot |
left(int angle)
Turns the turtle to the left for the given angle.
|
NxtTurtleRobot |
right(int angle)
Turns the turtle to the right for the given angle.
|
NxtTurtleRobot |
setTurtleSpeed(int speed)
Sets the turtle speed to the given value.
|
addPart, connect, connect, getAbout, getBatteryLevel, getInputStream, getIPAddress, getOutputStream, getVersion, isConnected, playTone, reset
public static final java.lang.String IPAddress
public static final int IPPort
public static final int MotorSpeed
public static final double MotorSpeedFactor
public static final int GearSpeed
public static final int GearAcceleration
public static final int GearBrakeDelay
public static final double AxeLength
public static final int TurtleSpeed
public static final double TurtleStepFactor
public static final int TurtleRotationSpeed
public static final double TurtleRotationFactor
public static final int SoundSensorPollDelay
public static final int LightSensorPollDelay
public static final int TouchSensorPollDelay
public static final int UltrasonicSensorPollDelay
public static final int connectionTimeout
public NxtTurtleRobot(ConnectionListener listener, java.lang.String ipAddress, int port, boolean immediateConnect)
listener
- a ConnectionListener to get connection notificationsipAddress
- the IP address of the brick, e.g. "10.0.1.1"port
- the IP port where the EV3DirectServer is listeningimmediateConnect
- if true, a connection trial is engagedpublic NxtTurtleRobot(ConnectionListener listener, java.lang.String ipAddress, boolean immediateConnect)
listener
- a ConnectionListener to get connection notificationsipAddress
- the IP address of the brick, e.g. "10.0.1.1"immediateConnect
- if true, a connection trial is engagedpublic NxtTurtleRobot(ConnectionListener listener, java.lang.String ipAddress)
listener
- a ConnectionListener to get connection notificationsipAddress
- the IP address of the brick, e.g. "10.0.1.1"public NxtTurtleRobot(ConnectionListener listener)
listener
- a ConnectionListener to get connection notifications
The default IP address "10.0.1.1" and port 1299 is used.public NxtGear getGear()
public NxtTurtleRobot setTurtleSpeed(int speed)
speed
- 0..100public int getTurtleSpeed()
public NxtTurtleRobot forward(int steps)
steps
- the number of steps to go.public NxtTurtleRobot backward(int steps)
steps
- the number of steps to go.public NxtTurtleRobot left(int angle)
angle
- the angle in degree to rotate.public NxtTurtleRobot right(int angle)
angle
- the angle in degree to rotate.