示例#1
0
 def get_route_node_arrow_waypoint_array(route):
     route_node_arrow_waypoint_array = []
     for arrow_code in route.arrow_codes[1:]:
         waypoint_id1, _ = Arrow.split_arrow_code(arrow_code)
         route_node_arrow_waypoint_array.append({
             "waypoint_id": waypoint_id1,
             "arrow_code": arrow_code
         })
     return route_node_arrow_waypoint_array
示例#2
0
                    type=str,
                    default="../../res/arrow.json",
                    help="arrow.json path")
parser.add_argument("-PS",
                    "--path_spot_json",
                    type=str,
                    default="../../res/spot.json",
                    help="spot.json path")
args = parser.parse_args()

if __name__ == '__main__':

    waypoint = Waypoint()
    waypoint.load(args.path_waypoint_json)

    arrow = Arrow(waypoint)
    arrow.load(args.path_arrow_json)

    spot = Spot()
    spot.load(args.path_spot_json)
    bus_parkable_spots = spot.get_spots_of_target_group(
        Target.new_node_target(SimBus))
    bus_stop_ids = list(bus_parkable_spots.keys())

    start_bus_stop_id = random.choice(bus_stop_ids)
    start_waypoint_id = bus_parkable_spots[
        start_bus_stop_id].contact.waypoint_id
    start_arrow_code = bus_parkable_spots[start_bus_stop_id].contact.arrow_code
    start_time = time() - 5

    bus_stop_ids.remove(start_bus_stop_id)
示例#3
0
from ams.nodes import Vehicle, SimCar
from ams.messages import vehicle_message

from pprint import PrettyPrinter

pp = PrettyPrinter(indent=2).pprint

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)
示例#4
0
parser = ArgumentParser()
parser.add_argument("-W", "--path_waypoint_json", type=str,
                    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)
示例#5
0
                    type=str,
                    default="../../res/intersection.json",
                    help="intersection.json path")
parser.add_argument("-WID",
                    "--start_waypoint_id",
                    type=str,
                    default=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",
示例#6
0
from time import time
from ams import Waypoint, Arrow, Route, Intersection
from ams.nodes import Autoware

WAYPOINT_FILE = "../../res/waypoint.json"
ARROW_FILE = "../../res/arrow.json"
INTERSECTION_FILE = "../../res/intersection.json"

if __name__ == "__main__":

    start_waypoint_id = "9566"  # "8809"  # "9566"  # 9232

    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)

    current_time = time()

    schedules = [
        {
            "scheduleID": "start",
            "startTime": current_time - 5,