Page 1 of 1

Line Following MyBlock Help Me Please!

Posted: 02 Oct 2012, 23:19
by datbikerguy
So I copied and modified Dave Parker's 5-state line follow program and made it into a MyBlock. We wanted it to work for only three rotations, but I am not sure how to connect it using a variable. The program and MyBlock are attached.

Could someone make some recommendations on how to use a MyBlock for linefollowing?

Re: Line Following MyBlock Help Me Please!

Posted: 03 Oct 2012, 14:36
by hassenplug
datbikerguy wrote:So I copied and modified Dave Parker's 5-state line follow program and made it into a MyBlock. We wanted it to work for only three rotations, but I am not sure how to connect it using a variable. The program and MyBlock are attached.

Could someone make some recommendations on how to use a MyBlock for linefollowing?
I would suggest looking at the values from the light sensor and see what gets returned when it is or isn't on the line. Unfortunately, this program won't do a very good job of following the line.

Maybe you could create a flow-chart or truth-table identifying what you what the robot to do, with different light sensor readings.

Steve

Re: Line Following MyBlock Help Me Please!

Posted: 09 Oct 2012, 23:28
by datbikerguy
Here is my truth table for line following, this part works fine by itself but I'm trying to convert it into a myblock that stops after a variable number of rotations.

Light Reading Robots Response
81-100 Hard Left
60-80 Gentle Left
40-59 Straight
20-39 Gentle Right
0-19 Hard Right

We don't know how to change the duration of the loop according to the number of rotations it makes. We tried having a rotation sensor go through a compare block and put the output into the loop control, but we did something wrong. Can you make any recomendations

Re: Line Following MyBlock Help Me Please!

Posted: 10 Oct 2012, 13:14
by hassenplug
Well, the solution is pretty simple. Maybe you need to think about how wires work a bit more.

When are you reading the rotation sensor? Or, to put it another way, how often are you reading the rotation sensor in the MyBlock?

(I already know the answer, but that's what you need to understand)

Steve

Re: Line Following MyBlock Help Me Please!

Posted: 23 Oct 2012, 22:44
by datbikerguy
That helped a lot! We got it to work. Thank you so much.