Maze&Avoid Obstacle

 

 

:1000

 

PLAY:ACTION:STAND   // Stand up

WAIT

PLAY:ACTION:CLIFF_DETECT_OFF  //Turn off cliff detection mode

WAIT

 

DO

  PLAY:ACTION:MOVE_HEAD:0:0  //Move head back to original position

  WAIT

 

  PLAY:ACTION:WALK:0:10000  //Go forward for 10000 mm

  

  FOR:t:1:1000

    IF:Distance:<:300:BREAK  // If AIBO finds a wall or t=1000 then break

    WAIT:1

  NEXT

 

  PLAY:ACTION:STOP_WALK  // Stop walking

  WAIT

 

PLAY:ACTION:MOVE_HEAD:90:0 // Move head to the left for 90 degrees

WAIT

PLAY:ACTION:MOVE_HEAD:-90:0// Move head to the right for 90 degrees

  SET:dd:0

  WHILE:Wait:>:0

    SET:d:Distance    // Distance to obstacle [mm]

    SET:p:Head_Pan// Head: horizontal (left-right) angle [degrees]

    IF:d:>:dd:THEN

      SET:dd:d

      SET:pan:p

    ENDIF

  WEND

 

  VDUMP:dd

  VDUMP:pan

 

  IF:dd:<:300:THEN           // No where to go (turn 180)

   PLAY:ACTION:TURN:180

   WAIT

  ENDIF

 

  PLAY:ACTION:MOVE_HEAD:pan:0    // Adjust direction

  PLAY:ACTION:TURN:pan

  WAIT

 

LOOP

 

 

Description:

    

    AIBO will avoid obstacle and search a clear path to escape the maze as possible he can.