command_tree = { "!load": get_available_plugins, "!unload": get_loaded_plugins, "!reload": get_loaded_plugins, } shell = CommandShell() shell.set_parse_tree(command_tree) # Start simulator and wait for the initialization events to finish sim.start() sim.wait_for_events() sim.flush() while True: try: input = shell.input("Simulator# > ") except (EOFError, KeyboardInterrupt): print "quit" break if input == "quit": break sim.msg_channel(input) sim.wait_for_events() sim.flush() sim.stop()
import time from simulator.car import Car from simulator.recorder import Recorder from simulator.simulator import Simulator simulator = Simulator() car = Car(simulator) simulator.connect() simulator.start() print car.set_throttle(.3223) print car.get_throttle() print car.set_steering_angle(.1) print car.get_steering_angle() duration = time.time() + 10 recorder = Recorder(car) try: recorder.start() time.sleep(5) finally: recorder.stop() simulator.stop()