def main():
rospy.init_node("evaluation_ac")
ac = ACControllerSimulator()
rospy.Subscriber("/aide/ac_control", Bool, callback=lambda msg: ac.increase_ac() if msg.data else ac.decrease_ac())
console = Console()
console.preprocess = lambda source: source[3:]
atexit.register(loginfo, "Going down by user-input.")
ac_thread = Thread(target=ac.simulate)
ac_thread.daemon = True
pub_thread = Thread(target=publish, args=(ac, ))
pub_thread.daemon = True
pub_thread.start()
while not rospy.is_shutdown():
try:
command = console.raw_input("ac> ")
if command == "start":
ac_thread.start()
if command == "end":
return
except EOFError:
print("")
ac.finished = True
rospy.signal_shutdown("Going down.")
评论列表
文章目录