public class TurtleRobot 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 |
---|
TurtleRobot(ConnectionListener listener)
Creates a TurtleRobot and engage a connection trial.
|
TurtleRobot(ConnectionListener listener,
java.lang.String ipAddress)
Creates a TurtleRobot instance with given IP address.
|
TurtleRobot(ConnectionListener listener,
java.lang.String ipAddress,
boolean immediateConnect)
Creates a TurtleRobot instance with given IP address.
|
TurtleRobot(ConnectionListener listener,
java.lang.String ipAddress,
int port,
boolean immediateConnect)
Creates a TurtleRobot instance with given IP address.
|
Modifier and Type | Method and Description |
---|---|
TurtleRobot |
backward(int steps)
Moves the turtle backward the given number of steps.
|
void |
exit()
Closes the communication and terminates the program.
|
TurtleRobot |
forward(int steps)
Moves the turtle forward the given number of steps.
|
Gear |
getGear()
Returns the gear used as component of the turtle.
|
int |
getTurtleSpeed()
Returns the current turtle speed.
|
TurtleRobot |
left(int angle)
Turns the turtle to the left for the given angle.
|
TurtleRobot |
right(int angle)
Turns the turtle to the right for the given angle.
|
TurtleRobot |
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 TurtleRobot(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 TurtleRobot(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 TurtleRobot(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 TurtleRobot(ConnectionListener listener)
listener
- a ConnectionListener to get connection notifications
The default IP address "10.0.1.1" and port 1299 is used.public Gear getGear()
public TurtleRobot setTurtleSpeed(int speed)
speed
- 0..100public int getTurtleSpeed()
public TurtleRobot forward(int steps)
steps
- the number of steps to go.public TurtleRobot backward(int steps)
steps
- the number of steps to go.public TurtleRobot left(int angle)
angle
- the angle in degree to rotate.public TurtleRobot right(int angle)
angle
- the angle in degree to rotate.