Sending turtlesim to Goal Location
When I was studying TF tutorials, I noticed that a calculation is performed in TF listener to send turtle2 to the location of turtle1. It is demonstrated below.
vel_msg.angular.z = 4.0 * atan2(transform.getOrigin().y(),
transform.getOrigin().x());
vel_msg.linear.x = 0.5 * sqrt(pow(transform.getOrigin().x(), 2) +
pow(transform.getOrigin().y(), 2));
Is there anybody who could understand this computation ?
I know that it is obvious. Orientation angle and the distance between two turtles are computed. The turtle2 is assumed to be reference point, and pose of turtle1 is computed with respect to frame of turtle2.
What I cannot understand is how this mathematical calculation enables turtle2 to approach turtle1 perfectly. There has to be senseful proof about this. Besides, it is not accurate how the constants 4 and 0.5 are chosen. For example, before seeing this computation, I thought that there has to be a p controller or pid controller code in this TF listener node. However, there is not anything about those controllers. Instead, distance computation exists, and I cannot understand how it really works.
Is there anyone who can explain this ?