Presentation is loading. Please wait.

Presentation is loading. Please wait.

Design of Control Strategy System Dynamics Environmental Disturbances Control Strategy GoalOutput Feedback Sensors.

Similar presentations


Presentation on theme: "Design of Control Strategy System Dynamics Environmental Disturbances Control Strategy GoalOutput Feedback Sensors."— Presentation transcript:

1 Design of Control Strategy System Dynamics Environmental Disturbances Control Strategy GoalOutput Feedback Sensors

2 Linebot Goal –Follow the path defined by the black line Strategy –Drive left and right treads at same speed –If left light sensor drops below threshold turn right. –If right light sensor drops below threshold turn left.

3 Linebot Implementation //define motor outputs #define LEFT OUT_A #define RIGHT OUT_B #define THRESH int dir=0; task main() { // configure the sensor SetSensor(LEYE, SENSOR_LIGHT); SetSensor(REYE, SENSOR_LIGHT); start decision; start motion_control; } We will introduce a global variable dir. If dir = 0 we will travel straight. A negative value for dir will cause us to turn left and a positive value of dir will cause us to turn right. Two sensors LEYE and REYE are defined. Two parallel tasks are started. Task decision will read the sensors and decide if we should go straight, turn left, or turn right. It will set the global variable dir to 0, -1, 1 depending on the readings of the sensors. Task motion_control will have access to the global variable dir and based on the value actuate the motors.

4 Linebot Implementation task decision() { // write the statements for this task } task motion_control() { // write the statements for this task } Task decision must continuously monitor the sensors (forever). It sets the global variable dir to - 1,0,1 depending upon the sensor readings. This will depend on the value of the defined constant THRESH. Task motion_control has a fast loop which cycles forever. It accesses the global variable dir and adjusts the motor signals.

5 The Decision W RIGHT_EYE x L LEFT_EYE X W/2-W/2 High value Low value Threshold value RIGHT_EYE AND LEFT_EYE both below threshold go straight RIGHT_EYE below threshold turn right LEFT_EYE below threshold turn left


Download ppt "Design of Control Strategy System Dynamics Environmental Disturbances Control Strategy GoalOutput Feedback Sensors."

Similar presentations


Ads by Google