[ROS2] time.sleep() in a node [closed]

asked 2022-05-11 04:38:38 -0500

rezenders gravatar image

updated 2022-05-11 06:03:52 -0500

Basically, I want to do the same thing as described in this other question but in ROS2: https://answers.ros.org/question/2333...

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)?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by aarsh_t
close date 2022-05-11 04:47:47.640726

Comments

Yes there is something like rate = node.create_timer(1) and rate.sleep() exist in the rclpy. Please refer this answer.

aarsh_t gravatar image aarsh_t  ( 2022-05-11 04:45:46 -0500 )edit
aarsh_t gravatar image aarsh_t  ( 2022-05-11 04:48:01 -0500 )edit