Line Following simulation using Direct Lookup Table 2-D
9 views (last 30 days)
Show older comments
I have a problem with a line following simulation algorithm design. My task is to simulate, using Simscape Multibody, the behaviour of an 4 wheeled vehicle that's using an infrared sensor to follow a designed line. Using the Image Processing Toolbox, I uploaded a picture of a custom closed circuit (that simulates the line) and the Toolbox created a single variable(596x949). This variable is used into a line following simulator which I took from a MATLAB video dedicated to line following design: https://www.youtube.com/watch?v=lr6i0Wss6RY. More precisely, the data generated with the Toolbox goes inside a Direct Lookup Table 2-D block. What I've noticed is that the block is yellow with a red border (is it an error, right?) as shown in the picture. Also, the 596x949 matrix is full of number 1. Is it normal or it may be an error of the Toolbox? Honestly, I don't understand how the simulator is working.
The main problem is that line following block is not working, it gives always a value of 1 even if the vehicle is not on the line. What can I do?
1 Comment
Adeep
on 8 Feb 2024
Hi Joseph,
Could you share your model or atleast a portion of it to better isolate the issue?
Accepted Answer
Vinayak
on 6 Feb 2024
Hi Joseph,
I've looked at the video tutorial you shared for the line following simulation. It seems that the matrix you're using, which is filled with the number 1, may not be representing the line and the surrounding area correctly. This could be why the Direct Lookup Table 2-D block is not functioning as expected and constantly outputs a value of 1.
To address this, you'll want to revisit the image processing step. The MATLAB video you referenced suggests using an app to generate a simulation map, allowing you to modify the threshold to correctly process the matrix. This is a crucial step to ensure that the line is accurately differentiated from the rest of the circuit in the matrix representation.
Here are some best practices to follow:
- Use Top View Images: Capture your circuit image from a top view under uniform lighting conditions to avoid shadows and reflections that could lead to artificial line breaks.
- Adjust Threshold: Modify the threshold settings in the app to prevent any artificial line breaks. This will ensure that the line is continuous and can be detected by the infrared sensor in the simulation.
If the app does not give you the desired results, consider manually processing the image using MATLAB's Image Processing Toolbox. Use functions like `imbinarize` for binarization, `edge` for edge detection, or other morphological operations to refine the line representation.
Finally, ensure that the inputs to the Direct Lookup Table 2-D block are correct and that the block is configured properly to interpret the processed matrix.
For further reading, you can refer to the MATLAB documentation on `Image Processing Toolbox` and `Lookup Tables `:
I hope this helps!
0 Comments
More Answers (0)
See Also
Categories
Find more on Simulation and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!