0

I am doing a simulation on a robot that makes circular motion with a center coordinate (x1, y1). The robot measures its position periodically and returns the information. Let's say the returned coordinate is (x3, y3). However, I'm not too sure about the correct way of using atan2 in python to calculate the angles between the current measurement and the last measurement with the center.

so far, I am doing the following, and would like to confirm if it's right:

current_angle = atan2(y3-y1, x3-x1)
last_angle = atan2(y2-y1, x2-x1)
angle_difference =  current_angle - last_angle

With the angle_difference, I then calculate the angular velocity = angle_difference / dt (dt is the time spent between the last measurement and the current measurement)

4

1 回答 1

1

几乎正确。给出的公式在通过第一和第四象限以及第二和第三象限之间的轴时会出现问题,因此您需要取角度差的绝对值的最小值,然后进行符号补偿。

于 2014-07-20T21:11:57.563 回答