[ROS2] time.sleep() in a node
Basically, I want to do the same thing as described in this other question but in ROS2: https://answers.ros.org/question/233331/timesleep-in-a-node/
In ROS1 I would just use
do_something()
rospy.sleep(1)
do_something_else()
In ROS 2 we have rclpy.timer.Timer and rclpy.timer.Rate. However, Timer needs a callback and both need a node attached. Is there anything as simple as rclpy.sleep(1)?
Asked by rezenders on 2022-05-11 04:38:38 UTC
Comments
Yes there is something like
rate = node.create_timer(1)
andrate.sleep()
exist in the rclpy. Please refer this answer.Asked by aarsh_t on 2022-05-11 04:45:46 UTC
Duplicate https://answers.ros.org/question/358343/rate-and-sleep-function-in-rclpy-library-for-ros2/?answer=358386#post-id-358386
Asked by aarsh_t on 2022-05-11 04:48:01 UTC