WAYPOINT_FILE = "../../res/waypoint.json" ARROW_FILE = "../../res/arrow.json" INTERSECTION_FILE = "../../res/intersection.json" if __name__ == '__main__': waypoint = Waypoint() waypoint.load(WAYPOINT_FILE) arrow = Arrow(waypoint) arrow.load(ARROW_FILE) route = Route() route.set_waypoint(waypoint) route.set_arrow(arrow) intersection = Intersection() intersection.load(INTERSECTION_FILE) start_waypoint_id = "9566" # 9232 currentTime = time() topic = Topic() topic.set_message(vehicle_message) schedules = deepcopy(topic.get_template()["schedules"]) schedules[0]["start_time"] = currentTime - 5 schedules[0]["duration"] = 10 schedules[0]["action"] = Vehicle.ACTION.STOP # schedules[0]["route"] = None # """
help="start waypoint id") args = parser.parse_args() if __name__ == '__main__': waypoint = Waypoint() waypoint.load(args.path_waypoint_json) arrow = Arrow(waypoint) arrow.load(args.path_arrow_json) route = Route() route.set_waypoint(waypoint) route.set_arrow(arrow) intersection = Intersection() intersection.load(args.path_intersection_json) stop_waypoint_ids = [ "8910", "8911", "8912", "8913", "8914", "8915", "8916", "8917", "8918", "8919", "8920", "8921",
default="../../res/waypoint.json", help="waypoint.json path") parser.add_argument("-A", "--path_arrow_json", type=str, default="../../res/arrow.json", help="arrow.json path") parser.add_argument("-I", "--path_intersection_json", type=str, default="../../res/intersection.json", help="intersection.json path") args = parser.parse_args() eventlet.monkey_patch() app = Flask(__name__) with app.app_context(): app.waypoint = Waypoint() app.waypoint.load(args.path_waypoint_json) app.arrow = Arrow() app.arrow.load(args.path_arrow_json) app.intersection = Intersection() app.intersection.load(args.path_intersection_json) app.topics = {} topic = Topic() topic.set_targets(Target.new_target(None, SimTaxiUser.__name__), None) topic.set_categories(User.CONST.TOPIC.CATEGORIES.STATUS) app.topics["user"] = topic.get_path(use_wild_card=True) topic = Topic() topic.set_targets(Target.new_target(None, SimTaxi.__name__), None) topic.set_categories(Vehicle.CONST.TOPIC.CATEGORIES.STATUS) app.topics["vehicle"] = topic.get_path(use_wild_card=True) topic = Topic()
parser.add_argument("-P", "--port", type=int, default=1883, help="port") parser.add_argument("-C", "--path_cycle_json", type=str, default="../../res/cycle.json", help="cycle.json path") parser.add_argument("-I", "--path_intersection_json", type=str, default="../../res/intersection.json", help="intersection.json path") args = parser.parse_args() if __name__ == '__main__': intersection = Intersection() intersection.load(args.path_intersection_json) with open(args.path_cycle_json, "r") as f: data = json.load(f) cycles = data["cycles"] traffic_signals = [] try: for intersection_id in intersection.get_intersection_ids(): for route_code, traffic_signal_configs in intersection.get_traffic_signals( intersection_id).items(): cycle_option = [] if traffic_signal_configs["cycleID"] is not None: cycle_option = [