我做了一個ROS節點,它使用python的扭曲協議建立與客戶端的連接。該方案是,但如預期工作時,我試圖殺死用Ctrl + c中的程序,它顯示以下錯誤消息:如何在按Ctrl + c時以乾淨的方式殺死python程序(包括ROS和扭曲的協議)?
[server_send_command_ver3-4]升級到SIGTERM
我已經包括以下的我的代碼部分:
if __name__ == '__main__':
try:
#node initialization
rospy.init_node('listen', anonymous = True)
#publisher to publish message to clientconnection to display connection status on GUI
connect = rospy.Publisher("status", String, queue_size = 10)
connect.publish(" Lost Connection")
#twisted protocol and listen at port 80
factory = Factory()
factory.protocol = NewFactory
factory.clients = []
reactor.listenTCP(80, factory)
reactor.run()
except rospy.ROSInterruptException:
pass
rospy鉤子的工作原理,但是如果刪除():''rospy.on_shutdown(reactor.stop)' –
@JaviV謝謝。編輯答案 – GSalazar