Dealing with discontinuities in the track

I am using Qtr8rc sensors with nicely tweaked PID parameters for line following. It is working good on continuous track but when it comes to dealing with discontinuities in track robot is coming back.
Then i used following snippet. ( using white line on black background)
If s[0]>500 && s[1]>500 && s[3]>500…
Go ahead ;

It works on discontinuities but on 90° turn it is also considering as discontinuities and moves forward without turning.
What can i do?
Also it is not taking 45° turns as well.

I moved your post to the “Software and microcontrollers” section of the forum since it primarily deals with code.

It sounds like you have it mostly working, but are having trouble with 90° and 45° turns. Sharp turns will likely take some special handling to do well, similarly to how you are determining the line ends. For example, when you encounter a 90° turn, the 4 sensors on the same side of the QTR-8RC sensor array should be seeing the line all at the same time. You could use this to determine that your robot has reached a 90° turn and execute a special turn sequence (e.g. right or left). Since your robot should generally be centered on the line, you might be able to just check the outer-most sensors, depending on your course. This is similar to how our maze-solving example code for the 3pi robot handles 90° turns; however, in that application, the robot needs to differentiate between, right turn, left turn, “T”, and “+” intersections, so there are some extra steps involved, but it might be a good reference.

Brandon

Question 1 :- How do I use pololu QTR1RC to get digital response without
using pololu library.

Question 2- How can I use QTR1RC as well as QTR8RC in the same robot.
I tried creating two qtrrc classes for each of them but couldn’t manger to
achieve results with QTR1RC. I tried for hours to get both sensors work
together but only QTR8RC works fine.QTR1RC performs well if used
individually, as soon as I add 8rc, 1rc stops giving me output.

Please help me to figure out this issue.
Thanks in advance :pray:

To use the QTR-RC sensors, you first have to drive the sensor pin high long enough for it to charge, then change the pin to an input and monitor it to see how long it takes to drop low again. This is how our library works; you can see this in the QTRSensors.cpp file on the GitHub page, in the code that starts at line 424.

As for your second question, our library supports declaring multiple classes to keep track of different sensors. Could you post the code that you have tried so far?

Brandon

Last problem has solved.
Now I came up with another one to disturb you :slight_smile:

I have QTR8RC and I want to use it with raspberry Pi (python).
Does pololu have any library designed to cope up with Raspberry Pi ?
If not how can I take individual readings of all 8 sensors ?

PLEASE HELP ME TO SOLVE THIS PROBLEM.
I SWEAR THIS ONE IS LAST ONE :slight_smile:

The Raspberry Pi does not handle precise timing very well, so I would recommend using a separate microcontroller for processing the readings from the QTR-8RC sensor and communicating that information back to the Raspberry Pi. You might consider something like our Arduino-compatible A-Star 32U4 Robot Controller LV with Raspberry Pi Bridge for doing something like that.

Brandon

if you are using arduino, why not use digitalRead() on each of those 6 sensors?

I’m not using arduino. I’m trying to use these sensors on Raspberry Pi

Hey Samirkape, I’m trying to use these sensors with raspberry Pi too, not sure I can get it working how I want yet but I’ve got some consistent readings. You might be able to use and build on the code I’ve posted here: http://www.digitalpolymath.co.uk/2017/03/05/pololu-qtr-8rc-sensor-on-rpi/

Not sure I’d go near PWM for LEDON atm though just turn it on high when needed.

best of luck.
tom

Samirkape - if you’re still interested in this here is how we have done it:

thanks a lot. now I can die peacefully :joy: