Significance of mathematical operation in solution exercise 2.3

Hi,

What is the significance of ‘t = (rospy.Time.now().to_sec() * math.pi)*turning_speed_rate’
in the solution of exercise 2.3. Does it really lead to an angular speed of 2 radians/s?

Thanks in advance.

Hi,

Its just a way of making it turn certain radians at a certain speed. Its not 2 radians perfectly, it was just a fast way of doing this

Hi,
It actually doesn’t lead to a velocity of 2 radians/s. Let’s re-examine this portion of the solution:

t = (rospy.Time.now().to_sec() * math.pi)*turning_speed_rate
# Map to only one turn maximum [0,2*pi)
rad_var = t % (2*math.pi)

my_quaternion = tf.transformations.quaternion_from_euler(0.0,0.0,rad_var)

In this snippet, t represents the angle turned by the frame over time. To achieve a consistent velocity of 2 rad/s, the calculation of t should be t = rospy.Time.now().to_sec() * 2 . This adjustment aligns with the formula θ = t * ω , where θ is the angular displacement and ω is the angular velocity.

Regards,
Jose

1 Like