![]() ![]() ![]() Some programs may work better with un-calibrated sensors-especially those that pass values directly to the steering option of the Move block. The are practical advantages and disadvantages to each. ![]() Principle: If the robot has only one light sensor, the line following program will instruct the robot to follow only one side of the line (left or right depending on the formulas used in the program and the orientation of the motors in the robot design).For NXT, many of the programs below use either " Calibrated" or " Un-Calibrated" light sensors. Several of the various programs are discussed and illustrated below. There are dozens (probably hundreds) of different programs that can be written to help the robot follow a line. Whether the line is straight, curved, or a combination of both, the robot will use a simple formula to determine its position in relation to the line and how it should move in order to stay on the line. Most line following programs utilize some formula for determining if the robot should move to the left, or right, in order to stay on the line. Line Following Methods (Example Programs) The code below is more of a pseudocode than any actual code you can copy-and-paste into your program. The getLightPercent() and getLightPortion() functions below may need to be created by you. Once the condition has been met in the until function, then stop the line following task to stop following the line. The purpose of using a separate task for line following is so you can break from the line following based on the use of existing until functions such as untilSonar(), untilTouch(), untilDistance(), wait(), etc. This exercise walks you through the different steps in setting up a line following task and running it from within the main task. If you have RobotC, here is a good exercise in the task of LineFollowing. Line Following RobotC Include File Exercise in Line Following (for RobotC) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |