I have to write a program to predict the location of a robot that's moving in a circle(well, almost circle). I'm getting sensor measurements(they could be with or without noise, both.) from the robot, its current (x,y) coordinates. I'm aware of how I might use Kalman or Particle filters to track the bot, but I have seen that people have been able to use arc tangent, distance between two measurements, and then 'cos' and 'sin' of the angle multiplied by the distance to predict the next point. Can anyone please help me understand the intuition behind this technique?
Here's the algorithm:
delta_y = current-point(y-coordinate) - previous_point(y-coordinate)
delta_x = current-point(x-coordinate) - previous_point(x-coordinate)
current_angle = atan2(delta_y, delta_x) //arc-tangent
turn_angle = current_angle - previous_angle
heading_direction = current_angle + turn_angle
distance = distance of(current_point, original_point)
x_predicted = current_point(x-coordinate) + distance * cos(heading_direction)
y_predicted = current_point(y-cooridnate) + distance * sin(heading_direction)
Regards,
$$(x,y)=(r\cos \theta,r\sin\theta)$$ given that your robot is moving on circle all you need is an angle. Since $\theta = \arctan(x,y)$ you can know the angle or the difference in angle between two subsequent measurements which give you a sort of velocity measurements which you can use to predict the next point.
Hope this makes sense.
Hint: use $\arctan 2$ instead of $\arctan$ it is usually in many math libraries, see here.