Line folower algorithm #2093
-
I am trying to make my robot follow a line using 2 color sensors those are almost directly next to eachother(there is one unit distance between them) and also to stop at the cross of lines if neccesary. I have tried to port a Spike scratch myblock to pybricks. I provided the screenshot of it. Then I tryed to port this Lego Python code: https://github.com/ofdl-robotics-tw/SPIKE-PD_Line_Follow |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
The picture for the pybricks program seems to be missing. You can edit your post and try again if you like. |
Beta Was this translation helpful? Give feedback.
-
Rather than porting existing code, it might also take a step back to study what the code is doing. In the original code, they are driving each motor at a speed of Also, you don't need any of the multitask blocks. Hope that helps as a starting point! |
Beta Was this translation helpful? Give feedback.
Both
.run
and.dc
can be used without multitasking. They just "start" the motor, so they don't take up time in your program.Curve is good if you intend to make a curve of a given length, but that has not much to do with line following.