Line Following MyBlock Help Me Please!

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
datbikerguy
Posts: 4
Joined: 02 Oct 2012, 23:04

Line Following MyBlock Help Me Please!

Post 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?
Attachments
9-25linfollowmyblock.rbtx
5 state line follower
(531.08 KiB) Downloaded 421 times
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Line Following MyBlock Help Me Please!

Post 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
---> Link to lots of MINDSTORMS stuff under my picture --->
datbikerguy
Posts: 4
Joined: 02 Oct 2012, 23:04

Re: Line Following MyBlock Help Me Please!

Post 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
Attachments
left side LineFollow5.rbt
Here's what we tried
(1.5 MiB) Downloaded 445 times
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Line Following MyBlock Help Me Please!

Post 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
---> Link to lots of MINDSTORMS stuff under my picture --->
datbikerguy
Posts: 4
Joined: 02 Oct 2012, 23:04

Re: Line Following MyBlock Help Me Please!

Post by datbikerguy »

That helped a lot! We got it to work. Thank you so much.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 4 guests