00001 #!/usr/bin/env python 00002 00003 # automatically reset slam as robot put on the ground 00004 00005 import rospy 00006 from std_msgs.msg import Empty 00007 import subprocess 00008 00009 def callback(msg): 00010 rospy.loginfo("Killing /gmapping_node") 00011 subprocess.check_call(["rosnode", "kill", "/gmapping_node"]) 00012 00013 if __name__ == "__main__": 00014 rospy.init_node("auto_reset_slam") 00015 sub = rospy.Subscriber("/odom_init_trigger", Empty, callback) 00016 rospy.spin()