I have created a new line following programm. This time I have included a light sensor calibration function and the option to adjust the power settings by pressing the left / right buttons.
After some (failed) experiments with polynomial functions to calculate the speed of the wheels I decided to do something rather simple 🙂
The light sensor range is simply mapped to the range of the steering block. This works great with low power settings and is still acceptable with higher settings.
Download the Mindstorms Project File
I have a created two test tracks (A4 sized) that you can download here and here.
Building instructions for the robot can be found in this blogpost.
This works great with low power settings and is still acceptable with higher settings.
it is a great program, any idea if we need it to stop at the end if there is white end and, how to maximize the power and make it move straight .
light sensor calibration (min 128) and (max128)
and when run program it round it self
can you tell me where is the mistake?
Hi, I am not sure what exactly causes your problem but the light sensor should return normalized values between 0 and 100…
Hey we are trying to program your idea in Java.
Our Colorsensor only return values from 0 to 1
Can you please explain your calculation again, so we can transfer it to our code?
It´s a simple linear function. http://www.wolframalpha.com/input/?i=plot+1.8x-90
The result is passed to the steering block that takes values from -100 to 100 (I chose to limit it with +-90 for no special reason but I suppose it runs smoother this way).
(1,8*100)-90=90 (turn e.g. left)
(1,8*50)-90=0 (don´t turn just drive)
(1,8*0)-90=-90 (turn e.g. right)
You could use (180*lightsensorvalue)-90=steeringblock_input (If you have implemented something like the steering block)