ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
There is probably better ways to do what you want to do but for your case, you could catch the SIGINT signal and then restart your function
import signal import sys def signal_handler(signal, frame): print('You pressed Ctrl+C!')
robot_exec()
signal.signal(signal.SIGINT, signal_handler)
2 | No.2 Revision |
There is probably better ways to do what you want to do but for your case, you could catch the SIGINT signal and then restart your functionfunction. Try adding this to your code
import signal
import sys
def signal_handler(signal, frame):
print('You pressed
signal.signal(signal.SIGINT, signal_handler)