Using while loop with rclpy.ok() gives unexpected result
So, I am trying to use rclpy.ok()
as follows:
def main(args=None):
rclpy.init(args=args)
dynamixel_control = DynamixelControl()
while rclpy.ok():
rclpy.spin_once(dynamixel_control)
dynamixel_control.update_limb_status_temp()
# rclpy.spin(dynamixel_control)
dynamixel_control.destroy_node()
rclpy.shutdown()
dynamixel_control.__del__()
Now, while running this code, It is expected that one callback will be executed and then update_limb_status_temp()
should be called. Which is what happens, but when there is no subscriber callback to execute, then only update_limb_status_temp()
function should be called which is not happening? Is there any problem with this way of using this code and should i use other method. I cannot use timer function because I want to run update_limb_status_temp()
conditionally. Thanks for the help
Asked by LeibTon on 2023-07-13 06:55:56 UTC
Comments