Interrupting ROS node with a ctrl+c (in terminator shell)

asked 2019-02-16 09:25:03 -0600

pitosalas gravatar image

updated 2019-02-16 11:29:35 -0600

gvdhoorn gravatar image

I've seen many questions about this, including one of mine from a year ago. What about this case, where I think it all looks correct and nothing in the loop is long running, and yet I often have to do ^c many many times before it responds. Oddly shift ^c seems to interrupt better. I don't even know what shift ^c is!

I am running Kinetic on Ubuntu 16.04 dual botted on a 5 year old Mac Pro.

[I can hardly think this is related, but. I have this problem when I run terminator as the shell. But, it seems, without extensive testing, that when I run this same script from the shell built into vscode, the ^cs work reliably.]

    rate = rospy.Rate(5)
    count_log = 0

    while not rospy.is_shutdown():
        count_log += 1
        if (count_log % 10 == 0):
            print("\n#%s [%s] %s=%1.2f" % (count_log, self.state,
                                         self.m.closest_dir, self.m.closest_dist))
        if (self.m is None):
            pass
        elif (self.state == "find_wall"):
            self.handle_find_wall()
        elif (self.state == "follow_wall"):
            self.handle_follow_wall()
        elif (self.state == "emer_stop"):
            self.handle_emer_stop()
        rate.sleep()
edit retag flag offensive close merge delete

Comments

It's very hard to replicate your problem because you posted an incomplete code snippet. We don't know what is happening in those functions you call that could be blocking. Please post a minimal code sample that shows the problem.

Geoff gravatar image Geoff  ( 2019-02-19 17:38:20 -0600 )edit