CS 102B Robot Design Tuesday, 113004 - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

CS 102B Robot Design Tuesday, 113004

Description:

If obstacle hit, try an alternative direction (say right turn) If obstacle cleared, continue. If obstacle not cleared, try another alternative (say left turn) ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 7
Provided by: Mathematic53
Category:
Tags: 102b | design | robot | tuesday

less

Transcript and Presenter's Notes

Title: CS 102B Robot Design Tuesday, 113004


1
CS 102B Robot DesignTuesday, 11/30/04
  • Todays Class
  • Return Graded Project 4
  • Questions for Exam 2?
  • Internal robot navigation obstacle avoidance
  • Depth First Search
  • Hill Climbing
  • Exam on Thursday 12/2 see last times slides
    for information

2
Obstacle Avoidance using Internal Navigation
  • Recall
  • External navigation means using external
    landmarks to know position and orientation
  • Internal navigation keeps track of distances and
    turns to know position and orientation
  • Obstacle Avoidance Using Internal Navigation.
    Keep track of
  • Distance traveled (or time traveled)
  • Last turn direction (right, left)
  • Last orientation (north, south)
  • When obstacle is hit (or proximity detected)
  • Back up
  • Turn away from obstacle
  • Try to move forward again

3
Depth First Search
  • General idea
  • Travel forward as long as possible
  • If obstacle hit, try an alternative direction
    (say right turn)
  • If obstacle cleared, continue
  • If obstacle not cleared, try another alternative
    (say left turn)
  • If obstacle still not cleared, try last
    alternative (turn around)

4
The Program DFSNavigate.nqc
  • task main()
  • ClearTimer(0)
  • SetSensorType (SENSOR_1, SENSOR_TYPE_TOUCH)
  • SetSensorMode (SENSOR_1, SENSOR_MODE_BOOL)
  • SetSensorType (SENSOR_3, SENSOR_TYPE_TOUCH)
  • SetSensorMode (SENSOR_3, SENSOR_MODE_BOOL)
  • start RunRobot
  • start SenseObstacle
  • //end main()
  • task RunRobot()
  • timeStart Timer(0) //initialize
  • GoForward()
  • int lastOp F
  • until (Timer(0) TIME_PROG)

task SenseObstacle() while (true)
if (SENSOR_1 1 SENSOR_3 1)
CorrectCourse() //end if
//end SenseObstacle()
5
function CorrectCourse
  • int timeNow Timer(0)
  • int timeElapsed timeNow - timeStart
  • Halt()
  • BackUp()
  • WaitTenths(TIME_BACKUP)
  • Halt()
  • if (timeElapsed gt DELAY) TurnRight()
  • WaitTenths(TIME_RIGHT)
  • lastOp R
  • else if (lastOp R)
  • TurnAround()
  • WaitTenths(TIME_AROUND)
  • lastOp L
  • else if (lastOp L)
  • TurnLeft()
  • WaitTenths(TIME_LEFT)
  • lastOp A
  • else if (lastOp A)
  • Halt()
  • lastOp H
  • PlaySound (SOUND_DOWN)
  • StopAllTasks()
  • //Starting regular motion again
  • GoForward()
  • timeStart Timer(0)

6
Hill-Climbing Obstacle Avoidance
  • With the hill-climbing approach we commit
    ourselves to traveling in a single direction, and
    never turning back
  • Think of a ball rolling down a hill it cant
    turn back
  • North down
  • East Hill slants to right
  • West Hill slants to left
  • NE Hill Climbing algorithm may go north or
    east, never west or south. (Could also do NW.)
Write a Comment
User Comments (0)
About PowerShow.com