# How to approach an object

My question is more on a basic/conceptual level.

I'm looking into a way to approach an object in map, that I have detected earlier. My robot is localized in a map using SLAM. And object position is 2D point that I recieve from my algorithm. (Object is actually a face picture on a wall). Is there a smart way to approach the point and "look" at it?

• Hi Denis, and welcome to the Robotics Stack Exchange. Please can you be a little more detailed in your question? The obvious answer is "approach it head on". Would this be good enough? If not, why not? – Rocketmagnet Apr 20 '15 at 21:08
• There is more that one face on the map and can be positioned anywhere on the walls. Robot knows their location because it detected them earlier while exploring the map. Initial thoughts of my team were to draw an arc and check where the arc is on valid map position. Then move the robot there and calculate the angle to rotate the robot. Do you maybe know of any better solutions @Rocketmagnet ? – Denis Vitez Apr 21 '15 at 7:06

I wasn't totally sure what you meant by "draw and arc and check where the arc is on valid map position. Then move the robot there and calculate the angle to rotate the robot". Perhaps you mean something like this:

You draw an arc starting at the face, coming straight out of the all (tangent to the face's normal vector), and ending at the robot.

That's certainly one way to plan the path, and it works well if there's no obstacle in the way.

However, my own favourite path planning method is more computationally intensive, but works very well in many cases, handles acceleration and cornering, initial and final direction, and in many cases handles obstacle avoidance.

Iterative Finite Element Path Planning

Start by defining a path as a sequence of points from the face to the robot. The first 2 points should be along the line of the robot's forward travel direction, and the last 2 points should be along the Face's surface normal vector.

Now we will iteratively adjust the path:

while(path_is_not_OK())
{
n = number of points of path

// Loop through all the blue points
for(i=2; i<n-2; i++)
{
// move this point in the direction which reduces acceleration

prev_velocity = point[i]   - point[i-1]
next_velocity = point[i+1] - point[i]

acceleration = next_velocity - prev_velocity

point[i-1] -= acceleration * 0.01
point[i]   += acceleration * 0.02
point[i+1] -= acceleration * 0.01
}
}


I just wrote out that code from memory, so I don't guarantee its correctness.

After some number of iterations (about 50 - 500), you should see a nice smooth path from the robot to the target.

Feel free to add other adjustments into the loop to satisfy other constraints to may have on the path (for example wall or obstacle avoidance).

• Not exactly useful on my problem, since I only have position of the face and no orientation. To get normal vector of the faces surface I would have to detect wall orientation I suppose? But I like your Iterative algorithm and I will definitely try to use it for solving some other tasks. Thank you for your time :) – Denis Vitez Apr 22 '15 at 15:07
• See, the thing is you could have got a much better answer if you had included this information about no orientation in your original question. @Rocketmagnet spent time writing such a detailed answer that ended up being only marginally relevant to you. You can get much better use out of this site by framing your questions properly. – RaGe Apr 22 '15 at 19:17