Use of sleep() on real hardware
I found an inconsistent behaviour between using on simulation environment and on real hardware(robot). The following code snippet is what has been used on a real hardware(by commenting r.sleep()
and rospy.sleep(1)
). What I don't understand is that why the code that works on simulation requires commenting on those sleep()
functions in order to make it working on a real hardware.
if __name__ == '__main__':
rospy.init_node('my_node', anonymous=True)
oaa = obs_armj_all()
r = rospy.Rate(100)
while not rospy.is_shutdown():
try:
oaa.listener()
#r.sleep()
#rospy.sleep(1)
#rospy.spin()
except rospy.ROSInterruptException:
pass
I would highly appreciate if somebody can explain on the underlying concept behind this kind of behaviour.
Thanks in advance.
Do you still have using_sim_time set on the real hardware tests?
No, "using_sim_time" is only set on the simulation.
can you clarify what the different behaviors are that you are seeing more clearly in each case and what you expect in each case?
Why do you use all these different sleeps together? Also the while construction that you use seems very strange to me. Firstly, you somehow use 3 different sleeps, since rospy.spin is somehow a sleep https://answers.ros.org/question/3321... also rospy.spin() and while rospy.is_shutdown() are not the same but it seems strange to use them together, see https://get-help.robotigniteacademy.c...