Python 3 for robotics simulation time and real world time mismatch

Hello I am currently on the unit 4 of the python 3 for robotics course. I find that there is a mismatch between the real world time and simulation run time. For example if I were to run robotcontrol.move_straight_time("forward", 0.3, 6) I would expect the robot to move forward for 6 seconds but it is not moving for 6 seconds it just moves for 1 or 2 seconds and stops. The code was working properly a week ago only now is it not working properly.

One solution I found out was to change the rate variable in the class defenition found at

‘home/simulations/public_sim_ws/src/all/ros_basics_examples/python_course_class/robot_control_class.py’

there is a line :

i += 1 in the function move_straight_time

I changed it to

i += 0.1 just like in the function turn

which made the simulation time equal to the real world 6 seconds time.
If someone from robot ignite academy can see if this is the solution to the problem and modify the values in everybody class definition it would be great.

Hi @pranav0506,

welcome to our community.

Thanks for pointing this out. We really updated the ros_basics_examples/python_course_class/robot_control_class.py on 2020-05-27, changing the rate from 1 to 10. This explains why the loop finishes faster now.

The ideal solution would be just to change the rate from 10 hz to 1 again.

I’ll talk to @albertoezquerro and we will wither update the rate back to 10 or update the notebook instructions.

Once again, thanks for point this out.
Cheers,