WASD Robot - jetstreamc/PySimbot GitHub Wiki

The purpose of this example is for testing the PySimbot environment and understanding how can the robot moves in the environment.

By running this example, the PySimbot will create the Simulation which contains the robot, food, and obstacles. The robot, by default, will have no moving logic because you need to handle the robot logic by yourself. However, to understand and test the robot movements in the predefined environment, the manually control robot is the fastest way.

WASD Robot example illustrates the manually control the robot by WASD keys. By default, you cannot manually control a robot. However, you can enable the WASD keys for the testing purpose.

  • W - move the robot 5 pixels forward or move(5)
  • A - left turn the robot 5 degrees around its center or turn(-5)
  • S - move the robot 5 pixels backward or move(-5)
  • D - right turn the robot 5 degrees around its center or turn(5)

Screenshot

To run this example, enter this command

python example1_wasd_robot.py

The key point of this example is to pass the enable_wasd_control=True to the PySimbotApp constructor to enable this function.

app = PySimbotApp(enable_wasd_control=True)

Full code of this example is available at example1_wasd_robot.py