Пример #1
0
parser.add_argument("-A",
                    "--path_arrow_json",
                    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
Пример #2
0
from ams import Waypoint, Arrow, Intersection, Route, Topic
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()