8. AI Development8. AI Development\8.4 Conditions and Actions8.4 Conditions and Actions\8.4.2 Basic Actions

8.4.2  Basic Actions

The following basic actions can be defined in the graphical programming interface.

v  Duration – execution time of the action

v  Key Action – pre-defined special actions

v  WheelLeft – Rotational speed of the left wheel

v  WheelRight – Rotational speed of the right wheel

v  LED_1 – LED status

Fig. 8-24 shows the basic action panel.

Picture22

Fig. 8-24: Actions

Duration

Duration is used to specify the time that the action is executed continually. Within this period, the robot’s action will not be interrupted by other statement, except the Super action. The unit of duration is ms.  The minimum duration is 60ms.

Define robot moving direction

The direction and speed of the two wheels can be controlled independently. Each wheel can be set to a value between -5 and +5, where +5 is maximum forward speed, -5 is maximum reverse speed and 0 is stop.

 

Movement

Left Wheel

Right Wheel

Robot moves forward

Positive Value,  e.g. “+1”

Positive Value

Robot turns right

Positive Value

Negative Value, e.g. “- 1”

Robot turns left

Negative Value

Positive Value

Robot moves backwards

Negative Value

Negative Value

 

Define robot moving speed

Speed Setting

Motor Speed

0

Stop

1

20% of its full speed

2

40% of its full speed

3

60% of its full speed

4

80% of its full speed

5

full speed

 

Set LED display

The LEDs can be set by setting the LED value to different values:

LED Setting

What it means…

0

LED – off

1

LED – blinks

2

LED – steady display

 

Key Action

For certain tasks, a key action must be specified from the drop down menu:

Fig. 8-25: Add a new state

Key Action

What it means…

FindObject

 

The action is needed when an object is found.

When the “FindObject” key action is executed, the internal variable associated with the “LoadedObjects”, the loaded objects counter, will be added by 1.  The robot will move forward at wheel speed of “+2” for  6x64ms at the end of the action.

Deposit

 

The action is needed when a robot deposits the objects.

When the “Deposit” key action is executed, “LoadedObjects” will be reset to 0. This helps to clear the loaded object counter. The robot can continue to pick up objects after deposit.

Teleport1

 

The action is needed when teleporting.

When the “Teleport1” key action is executed, the WORLD_2 will be used. The robot will be sent to the 1st teleporting location. The loaded object counter, LoadObjects, will be set to 0. The robot will be set stationary. LED will be off.

“Teleport2” or “Teleport3” means the robot will be teleported to the 2nd or 3rd teleporting location.

GameEnd

Not in use.

 

More examples:


Action

How to program…

Robot moves forward with 40% of the full speed for 60 ms

Robot moves forward with 40% of the full speed for 120 ms while LED is flashing.

Robot moves forward with 40% of the full speed for 120 ms. At mean time. The internal variable “Alpha” is set to 5.

Use advanced action.

 

 

Top of Page