exit from rospy.is_shutdown(): without shutdown node
i am using while not rospy.is_shutdown(): loop in a function but i can't exit from the function
how i can exit from while not rospy.is_shutdown() loop without shutting down the node i have issue to exit from function()
def function():
..
while not rospy.is_shutdown():
..
..
def clbk_laser(msg):
..
..
function()
..
..
def main():
rate = rospy.Rate(20)
while not rospy.is_shutdown():
..
..
...
...
if __name__ == '__main__':
main()
Update
i tried many ways like exit break return .. without result get out from while not rospy.is_shutdown() loop i think is different because using sys.exit(0) i shutdown the node and return or break do nothing i keep inside the loop
Can you provide your code and more details about what you want to achieve please ? This loop can only be exited with
CTRL-C
.Thank you for the edit. Why are you using a
while not rospy.is_shutdown()
loop if you want to exit it without shutting down the node ? You should use something like :Update : Can you also update the code when using
break
? That should exit the loop if correctly used. Also if you could detail why you are using awhile not rospy.is_shutdown
inside a function called in a callback could be helpful because that's not a common thing to do.