Download presentation
Presentation is loading. Please wait.
1
Design of Control Strategy System Dynamics Environmental Disturbances Control Strategy GoalOutput Feedback Sensors
2
Linebot Control Strategy System Dynamics Environmental Disturbances motion_control GoalOutput Feedback decision Task decision() monitors the sensors and issues a control signal dir to task motion_control(). The signal dir is a code -1,0,1,2 to represent turn left, go straight, turn right, or stop. Task motion_control() issues the steering commands to the bot.
3
Design of Control Strategy System Dynamics Environmental Disturbances Goal2 Output feedback navigate line_follow Goal1 Goal 1: Follow the line Goal 2: Navigate to desired position
4
Task Structure line_follow() This is the old motion_control used in linebot to control the lateral line-following motion. navigate() a new task that takes over at an intersection. It decides which way to turn and executes the motion control to effect turning. feedback() is the old decision() task. It measures the sensors and changes the dir variable.
5
Task Structure Continued The tasks navigate and feedback cannot function at the same time. If task feedback signals that the bot has reached an intersection, line_follow must be stopped and navigate must be started.
6
Variables What variables do we need? We already have one which we called dir-- it is issued by feedback() which assigns values to indicate: turn right, turn left, go straight, and at an intersection. The master control is issuing a command to go to some final destination. This must be kept as a variable. What intersection are we at? Our decision to turn right or left at an intersection depends upon: Where we are and Where we want to go.
7
Navigation Strategy Suppose we can count the intersections. Depending upon the intersection number, certain destinations will only be achieved if we turn right, others if we turn left. We could use a bunch of if statements to branch to the decision rules for each intersection, or we could use a switch control structure.
8
The switch control structure switch(x) { case 1: // do something when x is 1 break; case 2: // do something when x is 2 break; case 3: // dosomething else when x is 3 break; default: // do this when x is not 1,2,or 3 break ; }
9
This is equivalent to the following if statements //put default statement if x is not 1,2, or 3 if(x==1) //add statement executed when x is 1 if(x==2) //add statement executed when x is 2 if(x==3) //add statement executed when x is 3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.