ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Your code is not doing this correctly. Please look at section 2 of http://wiki.ros.org/rospy/Overview/Time for the proper way to construct a while/Rate loop in python.

while not R.is_shutdown:
    print(t_o)
    pub.publish(t_o)
    R.Rate(10)        # <- wrong
R.spin()    #  <- wrong

Your code is not doing this correctly. Please look at section 2 of http://wiki.ros.org/rospy/Overview/Time for the proper way to construct a while/Rate loop in python.

while not R.is_shutdown:
R.is_shutdown:     # <- wrong
    print(t_o)
    pub.publish(t_o)
    R.Rate(10)        # <- wrong
R.spin()    #  <- wrong