pasterpolar.blogg.se

Robotc functions
Robotc functions




  1. ROBOTC FUNCTIONS HOW TO
  2. ROBOTC FUNCTIONS CODE

ROBOTC FUNCTIONS CODE

Program: measuredistance.c Code added to wait until the touch sensor is pressed to keep the information visible on the robot screen. The encoder outputs the rotation of the motor in degrees so we convert the output to rotations. YouTube: 32ģ4 Find The Ball Stand General idea Now that we can travel from one base to another, we can align our robot with the ball stand by traveling half way to a base The rules specify that the bottle will be located in the middle of the playing field The dimensions of the playing field are L and W The distance traveled should be H/2 or W/2 Once the appropriate distance is traveled, turn 90 degrees and travel towards the ball stand 34ģ5 Find The Ball Stand Approach Modify LineFollowZZStop.ev3 to stop at the location of the ball stand Spin 90 degrees Travel to the ball stand Tools needed Line following Measure distance traveled Precise turning 35ģ6 Measure Distances Determine how far the robot travels moving forward for 2 seconds Compute distance traveled by measuring the number of rotations of the wheel Distance 36ģ7 Measure Distances Use the wheel geometry PI = 3.14 Radius How can use this information? 37ģ8 Measure Distances Here we reset the a motor encoder. Program: linefollowzzstop.c Once edge is reached, we exit while loop and stop the robot. 31ģ2 Run The Bases Here we modify the while loop conditional statement to use the second color sensor to detect when the edge of the field is reached.

robotc functions robotc functions

Let s change the outer loop to stop when the green is reached.

ROBOTC FUNCTIONS HOW TO

Program: LineFollowZZ.c YouTube: 26Ģ7 How to improve our line following algorithm Zig-zag method can cause a bumpy response To improve the response, you can use a 3-level line follower (concept shown below) Off Table On Table Off Table On Table 27Ģ9 Run The Bases One method to move from one base to another is the use two color sensors Sensor 1 used to follow the edge of the playing field Sensor 2 used to locate the end of the playing field Color sensor 2 Color sensor 1 29ģ0 Run The Bases Couple comments regarding moving around the field It is possible to achieve this using only one color sensor, but it more difficult and potentially less reliable Remember that only two of the bases have foil tape, please keep this under consideration When your robot finds the foil tape, which base are you at Need to count bases without a foil tape indicator 30ģ1 Run The Bases Let s modify the program to stop when the robot reaches the end of the base line Currently the program will line follow until we stop the robot. Based on color senor reading, determine which direction to travel to line follow.

robotc functions

25Ģ6 Simple Line Following Algorithm Set the threshold value.

robotc functions

Color Sensor 1 Color Sensor 2 On field = (70) On field = (70) Off field = (10) Off field = (10) Color Sensor Readings 24Ģ5 Follow The Edge Of The Field or Mat Light sensor settings example Off field = 10 On field = 70 Median threshold = (10+70)/2 = 40 Two cases Light sensor reading > 40. We will use the color sensor in Reflective Light Intensity mode. 24 Follow The Edge Of The Field or Mat Get color sensor values to determine when the robot is on or off the playing field.






Robotc functions