Trying to follow a line here. Coded it so whenever white is detected, it will go backwards since there are instances where it needs to go left or right so I can’t set it to go only one direction. Problem is, it gets stuck in an infinite loop of going back and forth the moment it detects a black line and then a white one again. It’s also supposed to go pretty fast since it’s a race so… help?
Trouble following custom track with mBot line sensors
@AAA If you have other sensors, this would be the way to go, because:
The sensor is not much thicker than the line, so the line is hard to detect.
With two, however:
The detection method is different, but the area is much broader.
You could thicken your line, but that is a bit troublesome. About the only thing you can do is slow the mBot down due to the physical limitations of the device. I will see if there is anything else I can figure out, but…
We actually use two and the line is thicker than the sensors so…
But we did slow it down and it finished the track. But now they’ve given us a new track and it’s giving us headaches—
We will attempt to hopefully speed up the previous one. I’ll maybe suggest to our couch to opt for just one line sensor and a thinner line if we have any at the school robotics lab. Thank you for your time and assistance so far!
By the way @AAA, you can read the docs here:
https://education.makeblock.com/help/me-line-follower/
and buy more sensors here, if you need:
https://www.makeblock.com/products/sh-me-line-follower-sensor
I hope the URLs help you!
@Best_codes the URLs really helped with the first track! But with the new track, we keep on getting stuck on the encircled parts:
I would assume then that the mBot is going quickly around those turns, and then losing sight of the line, and for the others being confused by the random breaks in the line. What is your code like @AAA? Also, please stick around for a minute or two if you mention me because I can normally respond quickly when mentioned.
@Best_codes the mBot is going fairly quickly but slow enough to get past some curves. The moment both sensors detect white, it immediately goes backward and it just loops from there. If we try to lessen the power even more though, it just stops.
Try changing the move backward block to either move forward very slowly or to turn left very slowly. (I think left might work). @AAA
Also, these parts of your track might be impossible (at least with your current code):
We tried to make it move left yesterday but then our problem was when it needed to make right turns.
What changing it to move left should do is make it turn left when it can only see white, but turn right or go forward or whatever else it needs to do when the detection is no longer white only.
Changed it to left, it went the other way and then back to the start instead of progressing. Changed it to right but the moment the right side detects black after it turns right when it detects all white, it goes back to the left and then the cycle repeats.
Ahh, I see. So if it, what position is the mBot in (rotation) when it gets stuck on the turns? Because I should think that backing up would help, now that I see the issue. (Good job on that code ).
P.S. Do you mind if I change the post title?
Also @CommandeR any suggestions?
@Best_codes I don’t mind. I just really wanna finish this track and hopefully use my newfound knowledge for future projects that might face this problem.
As for the position of the mBot, in the sharp turn, it turns right but then the code for when the right side detects black comes into play causing it to go left and detect all white again and it just loops since it’s rapidly detecting the change in values.
@AAA OK, thanks.
I will think about some solutions, but I don’t know if there really is much to do with that track.
By the way, when I said
I meant that you would have two me line follower sensors on the same mBot. Just to clarify .
Yeah, we did try putting two since our coach also told us to try it so we’ve been using two since yesterday. I just changed mine back to one a few hours ago.
Heya. Me again. I’m back at with the original path (the first track I needed help with) and I wanted to know if there was a way to make the turns smoother.