# How to make my robot move parallel to edge of the table?

I have an autonomous differential drive robot that moves on the floor and its purpose is to always move parallel to the longer edge of the table (just assume that the table never ends). It looks something like :

Now, the robot will be using this same method to align itself to the table edge for the first time. Also, when it travels forward (along the edge), it is prone to deviate from its path due to various reasons. Again, this method will guide it to stay on the right track.

I can't use any line-following method.

I can't use any line-following method.

Actually, you are quite wrong, the way I understand the problem. It is a line-following. It is just that the line is not painted (like on the road). The line is the edge of the table.

The way I see it, your robot needs to look up, and detect the line "painted" by the edge of the table on the ceiling. Once the line is detected, just follow it.

I have in mind 2 ways to detect the edge of the table.

1. Contrast based: using an imaging sensor (e.g., camera), detect the edge of the table by detecting the contrast / color change. Based on this, adjust the trajectory.

2. Distance measurement: an IR sensor (practically, more) can be used to measure the distance to the first obstacle (table or ceiling), vertically. It should be easy to do, considering that the ceiling is significantly higher than the table.

• Ah yes, we can just use a reflective IR sensor, looking up. – tlfong01 Oct 5 '20 at 6:42
• I do not know if a reflective IR sensor is suitable. Even if it is, there should be more than 1, I guess, for any practical purpose. I assume that the "vehicle" can come from any point, and it must understand the relative position to the table edge to correct the trajectory. I fully agree with the "looking up" part. – virolino Oct 5 '20 at 6:49
• By "any line-following method", I meant to specify that the answers avoid any assumption that a linr could help. Your method sounds good, can you please make it more specific as what to use and what methodology can be used? Thanks – Pe Dro Oct 5 '20 at 7:17
• IR sensors might not be the right choice here, as their performance will be strongly influenced by the lighting in the environment. Fur such large distances it is not always predictable how shadowing will occur on the robot, how IR light will be reflected and how the environment is already lit in the IR spectrum. – 50k4 Oct 5 '20 at 8:33
• @PeDro: Then you just detect the edge of the table - that is fine. No need to use paint or tapes. Joke: maybe you can use green stripes? Or pink? :) – virolino Oct 5 '20 at 12:21

The problem you are describing is quite similar to line following from a controls perspective, there is a difference in how the line is detected.

Line following robots use a wide variety of ways to detect line. Simplest is probably photo-resistors or phototransistors, however magnetic stripes (lines) and hall effect sensors have been quite popular in the industrial world some years ago.

Industrial applications of mobile robots have now switched to camera (and laserscanner) based systems. In many cases the camera is downward facing, however upward facing cameras are also not uncommon (not exactly industrial, but roomba vacuums use also partially upward facing cameras)

If you mount a camera on your robot, facing upwards, and the edge of the table is visible, you can use edge detection algorithms to detect the edge of the table. If you are lucky and there is a high contrast between the area under the table and above the table edge detection will perform quite well.

The edge is your line, but you still have to map this to the line you want to follow. The line being in the middle of the camera image is not necessarily what you want, but you can apply simple transformations to make this line your path to follow. If you can deduce a signed distance function (negative distance one side of the line, positive distance on the other side of the line, zero on the line) you can use this signed distance function as an input to your line following controller.

The only difference to a more common line following approach is how you detect the line and com up with the current position relative to the line. Everything else is like a classical line following problem.

• Yeah, before posting the question, this is what I had in mind. After these great answers, I think I can now trust my intuition that going with cameras is the right way. – Pe Dro Oct 6 '20 at 4:57