khepera
Class LEDController
java.lang.Object
|
+--khepera.LEDController
- All Implemented Interfaces:
- KheperaConstants
- public class LEDController
- extends java.lang.Object
- implements KheperaConstants
This class provides simple methods to flash the khepera base LEDs in a preset pattern. This is useful to
visualize when the robot is in a specific mode, following a specific behaviour etc.
Note
Since every time a LED status have to be changed a command is issued to the robot. This puts a load
on the communications link. If you are having trouble getting as many readings as you would like, this LED
blinking controller is probably the fist feature to remove.
- Version:
- 1.3
- Author:
- Pär Spjuth
|
Field Summary |
static int[] |
BLINK_BOTH
Predefined blinking pattern making both the LEDs blink simultaneously. |
static int[] |
DOUBLE_FLASH
Predefined blinking pattern flashing both leds twice one at a time before repeating the pattern. |
static int[] |
POLICE
Predefined blinking pattern making the LEDs blink somewhat like the lights on an old police car. |
| Fields inherited from interface khepera.KheperaConstants |
BL10, BR10, FL10, FL45, FL90, FLED, FR10, FR45, FR90, HEADING, LLED, LOWERED, OFF, ON, RAISED, RDIAMETER, RRADIUS, TOGGLE, UNCHANGED, XPOS, YPOS |
|
Constructor Summary |
LEDController(Khepera robot)
Creates a new controller assigned to the specified robot. |
|
Method Summary |
void |
start(int[] pattern)
Starts a LED blinking pattern. |
void |
stop()
Stops the current blinking pattern and turns off the LEDs. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BLINK_BOTH
public static final int[] BLINK_BOTH
- Predefined blinking pattern making both the LEDs blink simultaneously.

DOUBLE_FLASH
public static final int[] DOUBLE_FLASH
- Predefined blinking pattern flashing both leds twice one at a time before repeating the pattern.

POLICE
public static final int[] POLICE
- Predefined blinking pattern making the LEDs blink somewhat like the lights on an old police car.

LEDController
public LEDController(Khepera robot)
- Creates a new controller assigned to the specified robot.
- Parameters:
robot - The robot to be affected by the controller commands.
start
public void start(int[] pattern)
- Starts a LED blinking pattern. The pattern is made up of triplets in the double array sent as parameter.
The triplets has the following property:
(ledNr,status,delay)
Where ledNr if the number of the LED to be affected, status the new status of the LED and
delay the number of milliseconds to pause before continuing to the next triplet. The pattern is
looped infinitely.
Example:
double BLINK_FRONTAL[]={FLED,ON,250,FLED,OFF,250};
This pattern will first turn on the frontal led and wait 250 ms. It will then turn it off and wait another
250 ms before starting the pattern over again.
stop
public void stop()
- Stops the current blinking pattern and turns off the LEDs.