Line Following

 Download the Line Following robofile.

  1. First double click on the Surveyor_SRV1b module in the processing pipeline. It may take a while to appear since it will immediately try to connect to the default SRV setting at When it does appear change the IP address to the one you are using. If you do not know the IP address of the robot you will have to check your router information or see the Surveyor forum for more information.

  2. Once you get the right IP address you should see the image from the SRV in the main RoboRealm GUI. From here you can place the robot on a black line and it should start following it.

  3. We start with the more difficult part of line following, the curve, especially for the SRV. As the SRV is not angled down towards the ground we have to work at getting useful direction information out from very few pixels.

  4. We first warp the image to get a better vertical view of the line and allow further away lines to be longer using the Perspective module.

  5. Then we eliminate parts of the image that are not close to the robot and are not needed for line following using the Crop.

  6. Using the Adaptive Threshold we identify locally light and dark parts of the image which will include the black line and other parts of the image.

  7. Since RoboRealm likes to work with white blobs as apposed to black blobs we use the Negative module to invert the image.

  8. To remove thinner lines that may be picked up inbetween the tiles we erode all blobs using the Erode module.

  9. To remove any other non-line parts we then use the Blob Filter to filter out all but the largest blob bigger than 100 pixels.

  10. To understand which direction the robot needs to move we use the Point Location module to identify the highest leftmost point in the remaining blob. The location of this point tells us how much the robot needs to turn in order to align the line in the center of the image. Note that this technique restricts the robot to following a line in the counter-clockwise direction. It will most likely fail if positioned the other way around.

  11. Finally we now need to tell the SRV how to keep on the line. We do this by analyzing the coordinate of the detected point. If the point is very left then the robot needs to turn left. But if the detected point is also very low the robot should pivot in the direction of the line instead of just leaning towards the appropriate direction. This is necessary as a slight movement of the SRV camera can lose the line in the camera.

    The VBscript module allows us to write some VBScript to scale the motor values of the SRV based on the X coordinate of the target point. The more the X location is to the left the faster the RIGHT wheel should turn and the slower the LEFT one should turn. The VBScript module produces a left_motor and right_motor variable that contains the suggested values that the SRV should perform. The SRV module then grabs those values and passes them onto the SRV to complete the cycle.