Esempio n. 1
0
def scenarios():
    with temp_scenario(name="straight", map="maps/straight.net.xml") as scenario_root:
        ego_missions = [
            # missions of laner and buddha
            t.Mission(
                t.Route(
                    begin=("west", 0, 30),
                    end=("east", 0, "max"),
                )
            ),
            t.Mission(
                t.Route(
                    begin=("west", 0, 40),
                    end=("east", 0, "max"),
                )
            ),
        ]
        gen_scenario(
            t.Scenario(ego_missions=ego_missions),
            output_dir=scenario_root,
        )

        yield Scenario.variations_for_all_scenario_roots(
            [str(scenario_root)], [AGENT_1, AGENT_2]
        )
Esempio n. 2
0
def two_agent_capture_offset_tenth_of_second():
    with temp_scenario(name="straight",
                       map="maps/straight.net.xml") as scenario_root:
        missions = [
            t.Mission(
                t.Route(begin=("west", 1, 20), end=("east", 1, "max")),
                entry_tactic=t.TrapEntryTactic(
                    wait_to_hijack_limit_s=0,
                    zone=t.MapZone(start=("west", 0, 1), length=100,
                                   n_lanes=3),
                ),
            ),
            t.Mission(
                t.Route(begin=("west", 2, 10), end=("east", 1, "max")),
                entry_tactic=t.TrapEntryTactic(
                    wait_to_hijack_limit_s=0.1,
                    zone=t.MapZone(start=("west", 0, 1), length=100,
                                   n_lanes=3),
                ),
            ),
        ]

        scenario = t.Scenario(
            traffic={},
            ego_missions=missions,
        )

        gen_scenario(scenario, output_dir=scenario_root)
        yield Scenario.variations_for_all_scenario_roots(
            [str(scenario_root)], [AGENT_ID, AGENT_ID_2])
Esempio n. 3
0
def scenarios():
    with temp_scenario(name="straight",
                       map="maps/straight.net.xml") as scenario_root:
        traffic = t.Traffic(flows=[
            t.Flow(
                route=t.Route(
                    begin=("west", 1, 0),
                    end=("east", 1, "max"),
                ),
                rate=50,
                actors={t.TrafficActor("car"): 1},
            )
        ])

        missions = [
            t.Mission(
                t.Route(begin=("west", 1, 10), end=("east", 1, "max")),
                entry_tactic=t.TrapEntryTactic(
                    wait_to_hijack_limit_s=3,
                    zone=t.MapZone(start=("west", 0, 1), length=100,
                                   n_lanes=3),
                ),
            )
        ]
        scenario = t.Scenario(
            traffic={"all": traffic},
            ego_missions=missions,
        )

        gen_scenario(scenario, output_dir=scenario_root)
        yield Scenario.variations_for_all_scenario_roots([str(scenario_root)],
                                                         [AGENT_ID])
Esempio n. 4
0
def scenarios(request):
    with temp_scenario(name="map", map=request.param[0]) as scenario_root:
        mission = t.Mission(route=t.Route(begin=("edge-west-WE", 0, 10),
                                          end=(request.param[1], 0, 40)))
        gen_scenario(
            t.Scenario(ego_missions=[mission]),
            output_dir=scenario_root,
        )
        yield Scenario.variations_for_all_scenario_roots([str(scenario_root)],
                                                         [AGENT_ID])
def scenario():
    with temp_scenario(name="map",
                       map="maps/straight.net.xml") as scenario_root:
        mission = t.Mission(route=t.Route(
            begin=("west", 1, 99.9),
            end=("east", 1, 10.0),
        ))
        gen_scenario(
            t.Scenario(ego_missions=[mission]),
            output_dir=scenario_root,
        )
        yield Scenario.variations_for_all_scenario_roots([str(scenario_root)],
                                                         [AGENT_ID])
Esempio n. 6
0
def uturn_scenarios():
    with temp_scenario(name="straight",
                       map="maps/6lane.net.xml") as scenario_root:
        ego_missions = [
            t.Mission(
                route=t.Route(begin=("edge-west-WE", 0, 30),
                              end=("edge-west-EW", 0, "max")),
                task=t.UTurn(),
            ),
        ]
        gen_scenario(
            t.Scenario(ego_missions=ego_missions),
            output_dir=scenario_root,
        )

        yield Scenario.variations_for_all_scenario_roots([str(scenario_root)],
                                                         [AGENT_ID])
Esempio n. 7
0
def scenarios():
    with temp_scenario(name="6lane", map="maps/6lane.net.xml") as scenario_root:
        actors = [
            t.SocialAgentActor(
                name=f"non-interactive-agent-{speed}-v0",
                agent_locator="zoo.policies:non-interactive-agent-v0",
                policy_kwargs={"speed": speed},
            )
            for speed in [10, 30, 80]
        ]

        def to_mission(start_edge, end_edge):
            route = t.Route(begin=(start_edge, 1, 0), end=(end_edge, 1, "max"))
            return t.Mission(route=route)

        def fifth_mission(start_edge, end_edge):
            route = t.Route(begin=(start_edge, 0, 0), end=(end_edge, 0, "max"))
            return t.Mission(route=route)

        gen_scenario(
            t.Scenario(
                social_agent_missions={
                    "group-1": (actors, [to_mission("edge-north-NS", "edge-south-NS")]),
                    "group-2": (actors, [to_mission("edge-west-WE", "edge-east-WE")]),
                    "group-3": (actors, [to_mission("edge-east-EW", "edge-west-EW")]),
                    "group-4": (actors, [to_mission("edge-south-SN", "edge-north-SN")]),
                    "group-5": (
                        actors,
                        [fifth_mission("edge-south-SN", "edge-east-WE")],
                    ),
                },
                ego_missions=[
                    t.Mission(
                        t.Route(
                            begin=("edge-west-WE", 0, 0), end=("edge-east-WE", 0, "max")
                        )
                    )
                ],
            ),
            output_dir=scenario_root,
        )
        yield Scenario.variations_for_all_scenario_roots(
            [str(scenario_root)], [AGENT_1]
        )
Esempio n. 8
0
import os
import pickle
from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))


with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[t.Mission(t.Route(begin=("E35-3", 1, 70), end=("E3-3l", 0, 30))),],
)
Esempio n. 9
0
        )
    ]
)

social_agent_missions = {
    "all": (
        [
            t.SocialAgentActor(
                name="open-agent",
                agent_locator="open_agent:open_agent-v0",
                initial_speed=20,
            ),
        ],
        [
            t.Mission(
                t.Route(begin=("west", 1, 10), end=("east", 0, "max")),
                task=t.CutIn(),
            )
        ],
    ),
}

ego_missions = [
    t.Mission(
        t.Route(begin=("west", 1, 5), end=("east", 0, "max")),
        task=t.CutIn(),
    )
]

scenario = t.Scenario(
    traffic={"all": traffic},
    ego_missions=ego_missions,
Esempio n. 10
0
import os
import pickle
from smarts.sstudio import gen_missions, gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[t.Mission(t.Route(begin=("E35-3", 2, 90), end=("E3-3s", 0, 30))),],
)

gen_missions(
    scenario, [t.Mission(t.Route(begin=("E3l-3", 1, 200), end=("E3-35", 1, 50))),],
)
Esempio n. 11
0
import os
import pickle
from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[
        t.Mission(t.Route(begin=("E3l-3", 1, 100), end=("E3l-3", 1, "max"))),
    ],
)
Esempio n. 12
0
import os
import pickle
from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[t.Mission(t.Route(begin=("E3l-3", 1, 200), end=("E3-35", 1, 20))),],
)
"""
from pathlib import Path

from smarts.sstudio import gen_missions
from smarts.sstudio.types import (
    Route,
    Mission,  
)


scenario = str(Path(__file__).parent)


gen_missions(
    scenario=scenario,
Esempio n. 13
0
from pathlib import Path
from smarts.sstudio import gen_scenario
import smarts.sstudio.types as t


missions = [
    t.Mission(t.Route(begin=("-gneE1", 0, 5), end=("-gneE1", 0, 97))),
    t.Mission(t.Route(begin=("gneE1", 0, 5), end=("gneE1", 0, 97))),
    t.Mission(t.Route(begin=("-gneE1", 0, 20), end=("-gneE1", 0, 97))),
    t.Mission(t.Route(begin=("gneE1", 0, 20), end=("gneE1", 0, 97))),
]


impatient_car = t.TrafficActor(
    name="car",
    speed=t.Distribution(sigma=0.2, mean=1.0),
    lane_changing_model=t.LaneChangingModel(impatience=1, cooperative=0.25),
    junction_model=t.JunctionModel(
        drive_after_red_time=1.5, drive_after_yellow_time=1.0, impatience=1.0
    ),
)

patient_car = t.TrafficActor(
    name="car",
    speed=t.Distribution(sigma=0.2, mean=0.8),
    lane_changing_model=t.LaneChangingModel(impatience=0, cooperative=0.5),
    junction_model=t.JunctionModel(drive_after_yellow_time=1.0, impatience=0.5),
)

traffic = {
    "1": t.Traffic(
Esempio n. 14
0
from pathlib import Path
from smarts.sstudio import gen_scenario
import smarts.sstudio.types as t

missions = [
    t.Mission(t.Route(begin=("gneE17", 0, 10), end=("gneE5", 0, 100))),
    t.Mission(t.Route(begin=("gneE22", 0, 10), end=("gneE5", 1, 100))),
    t.Mission(t.Route(begin=("gneE17", 0, 25), end=("gneE5", 0, 100))),
    t.Mission(t.Route(begin=("gneE22", 0, 25), end=("gneE5", 1, 100))),
]

impatient_car = t.TrafficActor(
    name="car",
    speed=t.Distribution(sigma=0.2, mean=1.0),
    lane_changing_model=t.LaneChangingModel(impatience=1, cooperative=0.25),
    junction_model=t.JunctionModel(drive_after_red_time=1.5,
                                   drive_after_yellow_time=1.0,
                                   impatience=1.0),
)

patient_car = t.TrafficActor(
    name="car",
    speed=t.Distribution(sigma=0.2, mean=0.8),
    lane_changing_model=t.LaneChangingModel(impatience=0, cooperative=0.5),
    junction_model=t.JunctionModel(drive_after_yellow_time=1.0,
                                   impatience=0.5),
)

traffic = {
    "1":
    t.Traffic(flows=[
Esempio n. 15
0
import os
import pickle

from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))


with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[
        t.Mission(t.Route(begin=("E35-3", 2, 50), end=("E3-3l", 2, "max"))),
    ],
)
Esempio n. 16
0
from pathlib import Path
from typing import Any, Tuple

import smarts.sstudio.types as types
from smarts.sstudio import gen_missions, gen_traffic

scenario = str(Path(__file__).parent)

patient_car = types.TrafficActor(name="car", )

shared_route = types.Route(
    begin=("edge-east", 0, 20),
    end=("edge-west", 0, 0),
)

traffic = types.Traffic(
    flows=[types.Flow(
        route=shared_route,
        rate=1,
        actors={patient_car: 1},
    )])

gen_missions(
    scenario,
    missions=[
        types.Mission(shared_route),
    ],
)
gen_traffic(scenario, traffic, "traffic")
Esempio n. 17
0
from pathlib import Path

from smarts.sstudio import gen_scenario
import smarts.sstudio.types as t


missions = [
    t.Mission(t.Route(begin=("edge-south-SN", 1, 40), end=("edge-north-SN", 0, 40))),
    # t.Mission(t.Route(begin=("edge-west-WE", 1, 50), end=("edge-east-WE", 0, 60))),
    # t.Mission(t.Route(begin=("edge-north-NS", 0, 40), end=("edge-south-NS", 1, 40))),
    # t.Mission(t.Route(begin=("edge-east-EW", 0, 50), end=("edge-west-EW", 1, 40))),
]

impatient_car = t.TrafficActor(
    name="car",
    speed=t.Distribution(sigma=0.2, mean=1.0),
    lane_changing_model=t.LaneChangingModel(impatience=1, cooperative=0.25),
    junction_model=t.JunctionModel(
        drive_after_red_time=1.5, drive_after_yellow_time=1.0, impatience=1.0
    ),
)

patient_car = t.TrafficActor(
    name="car",
    speed=t.Distribution(sigma=0.2, mean=0.8),
    lane_changing_model=t.LaneChangingModel(impatience=0, cooperative=0.5),
    junction_model=t.JunctionModel(drive_after_yellow_time=1.0, impatience=0.5),
)

vertical_routes = [("north-NS", "south-NS"), ("south-SN", "north-SN")]
Esempio n. 18
0
import pickle

from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[
        t.Mission(t.Route(begin=("E3l-3", 1, 150), end=("E3-35", 1, 20))),
    ],
)
"""
from pathlib import Path

from smarts.sstudio import gen_missions
from smarts.sstudio.types import (
    Route,
    Mission,  
)


scenario = str(Path(__file__).parent)

Esempio n. 19
0
import os
import pickle

from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[
        t.Mission(t.Route(begin=("E35-3", 2, 80), end=("E3-3s", 0, 50))),
    ],
)
Esempio n. 20
0
    ),
]

ego_missions = [t.EndlessMission(begin=("edge-south-SN", 1, 20), )]

social_agent_missions = {
    "all": (
        [
            t.SocialAgentActor(name="open-agent",
                               agent_locator="open_agent:open_agent-v0"),
            t.SocialAgentActor(name="rl-agent",
                               agent_locator="rl_agent:rl-agent-v1"),
        ],
        [
            t.Mission(
                t.Route(begin=("edge-west-WE", 1, 10),
                        end=("edge-east-WE", 1, "max")))
        ],
    ),
}

gen_scenario(
    scenario=t.Scenario(
        traffic={"basic": traffic},
        bubbles=bubbles,
        ego_missions=ego_missions,
        social_agent_missions=social_agent_missions,
    ),
    output_dir=Path(__file__).parent,
)
Esempio n. 21
0
from smarts.sstudio import gen_traffic, gen_bubbles, gen_missions

scenario = str(Path(__file__).parent)

# Definition of a traffic flow
traffic = t.Traffic(
    flows=[
        t.Flow(
            route=t.Route(
                begin=("west", lane_idx, 10),
                end=("east", lane_idx, -10),
            ),
            rate=50,
            actors={
                t.TrafficActor("car"): 1,
            },
        )
        for lane_idx in range(3)
    ]
)

# The call to generate traffic
gen_traffic(scenario, traffic, name="basic")

gen_missions(
    scenario,
    [
        t.Mission(t.Route(begin=("west", 0, 0), end=("east", 0, "max"))),
    ],
)
Esempio n. 22
0
from pathlib import Path

from smarts.sstudio import types as t
from smarts.sstudio.genscenario import gen_scenario

ego_missions = [
    t.Mission(t.Route(begin=("1_0_R", 1, 5), end=("1_2_R", 1, "max")))
]

gen_scenario(
    scenario=t.Scenario(ego_missions=ego_missions, ),
    output_dir=str(Path(__file__).parent),
    overwrite=True,
)
Esempio n. 23
0
import os
import pickle
from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[
        t.Mission(t.Route(begin=("E5-35", 1, 20), end=("E35-3", 0, 5))),
    ],
)
Esempio n. 24
0
])

open_agent_actor = t.SocialAgentActor(name="open-agent",
                                      agent_locator="open_agent:open_agent-v0")

laner_actor = t.SocialAgentActor(
    name="keep-lane-agent",
    agent_locator="zoo.policies:keep-lane-agent-v0",
)

gen_scenario(
    t.Scenario(
        traffic={"basic": traffic},
        social_agent_missions={
            "all": ([laner_actor,
                     open_agent_actor], [t.Mission(route=t.RandomRoute())])
        },
        bubbles=[
            t.Bubble(
                zone=t.PositionalZone(pos=(50, 0), size=(10, 15)),
                margin=5,
                actor=open_agent_actor,
                follow_actor_id=t.Bubble.to_actor_id(laner_actor,
                                                     mission_group="all"),
                follow_offset=(-7, 10),
            ),
        ],
    ),
    output_dir=Path(__file__).parent,
)
Esempio n. 25
0
import pickle

from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[
        t.Mission(t.Route(begin=("E3s-3", 0, 200), end=("E3-35", 1, 40))),
    ],
)
"""
from pathlib import Path

from smarts.sstudio import gen_missions
from smarts.sstudio.types import (
    Route,
    Mission,  
)


scenario = str(Path(__file__).parent)

Esempio n. 26
0
        "coach",
        "truck",
        "trailer",
    ]
])

laner_actor = t.SocialAgentActor(
    name="keep-lane-agent",
    agent_locator="zoo.policies:keep-lane-agent-v0",
)

gen_scenario(
    t.Scenario(
        traffic={"basic": traffic},
        social_agent_missions={
            "all": ([laner_actor], [t.Mission(route=t.RandomRoute())])
        },
        bubbles=[
            t.Bubble(
                zone=t.PositionalZone(pos=(50, 0), size=(10, 15)),
                margin=5,
                actor=laner_actor,
                follow_actor_id=t.Bubble.to_actor_id(laner_actor,
                                                     mission_group="all"),
                follow_offset=(-7, 10),
            ),
        ],
    ),
    output_dir=Path(__file__).parent,
)
Esempio n. 27
0
import os
import pickle

from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[
        t.Mission(t.Route(begin=("E3-3l", 1, 160), end=("E3-3l", 0, 500))),
    ],
)
Esempio n. 28
0
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from pathlib import Path

import smarts.sstudio.types as t
from smarts.sstudio import gen_scenario

missions = [
    t.Mission(
        t.Route(begin=("edge-south-SN", 1, 40), end=("edge-west-EW", 0, 60))),
    t.Mission(
        t.Route(begin=("edge-west-WE", 1, 50), end=("edge-east-WE", 0, 60))),
    t.Mission(
        t.Route(begin=("edge-north-NS", 0, 40), end=("edge-south-NS", 1, 40))),
    t.Mission(
        t.Route(begin=("edge-east-EW", 0, 50), end=("edge-west-EW", 1, 40))),
]

impatient_car = t.TrafficActor(
    name="car",
    speed=t.Distribution(sigma=0.2, mean=1.0),
    lane_changing_model=t.LaneChangingModel(impatience=1, cooperative=0.25),
    junction_model=t.JunctionModel(drive_after_red_time=1.5,
                                   drive_after_yellow_time=1.0,
                                   impatience=1.0),
Esempio n. 29
0
import pickle

from smarts.sstudio import gen_social_agent_missions
from smarts.sstudio import types as t

scenario = os.path.dirname(os.path.realpath(__file__))

with open(os.environ["SOCIAL_AGENT_PATH"], "rb") as f:
    social_agent = pickle.load(f)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent,
    name=f"s-agent-{social_agent.name}",
    missions=[
        t.Mission(t.Route(begin=("E3n-3", 2, 200), end=("E3-35", 1, 60))),
    ],
)
"""
from pathlib import Path

from smarts.sstudio import gen_missions
from smarts.sstudio.types import (
    Route,
    Mission,  
)


scenario = str(Path(__file__).parent)

Esempio n. 30
0
def main(args):
    all_args = get_args(args)
    num_agents = all_args.num_agents
    num_lanes = all_args.num_lanes
    born_lane_id = all_args.born_lane_id
    born_position_offset = all_args.born_position_offset
    target_lane_id = all_args.target_lane_id
    target_position_offset = all_args.target_position_offset

    trajectory_boid_agent = t.BoidAgentActor(
        name="trajectory-boid",
        agent_locator="scenarios.straight.agent_prefabs:trajectory-boid-agent-v0",
    )

    pose_boid_agent = t.BoidAgentActor(
        name="pose-boid",
        agent_locator="scenarios.straight.agent_prefabs:pose-boid-agent-v0",
    )

    traffic = t.Traffic(
        flows=[
            t.Flow(
                route=t.Route(begin=("west", lane_idx, 0), end=("east", lane_idx, "max"),),
                rate=50,
                actors={t.TrafficActor("car"): 1},
            )
            for lane_idx in range(num_lanes)
        ]
    )

    assert len(target_position_offset) == len(born_position_offset) == num_agents, ("different number")
    assert num_lanes <= 3, ("number of lanes can not exceed 3")
    for _i in range(num_agents):
        assert (born_lane_id[_i]<=2), ("the born_land_id can not exceed 2.")
        assert (target_lane_id[_i]<=2), ("the target_land_id can not exceed 2.")
        if not born_position_offset[_i] in ["max", "random"]:
            assert int(born_position_offset[_i])<=100, ("the born_position_offset should use value 0~100 or max or random.")
        if not target_position_offset[_i] in ["max", "random"]:
            assert int(target_position_offset[_i])<=100, ("the target_position_offset should use value 0~100 or max or random.")
    print("pass the assertion")
    missions = [t.Mission(t.Route(begin=("west", born_lane_id[agent_idx], born_position_offset[agent_idx]), end=("east", target_lane_id[agent_idx], target_position_offset[agent_idx]))) for agent_idx in range(num_agents)]

    scenario = t.Scenario(
        traffic={"all": traffic},
        ego_missions=missions,
        bubbles=[
            t.Bubble(
                zone=t.PositionalZone(pos=(50, 0), size=(40, 20)),
                margin=5,
                actor=trajectory_boid_agent,
            ),
            t.Bubble(
                zone=t.PositionalZone(pos=(150, 0), size=(50, 20)),
                margin=5,
                actor=pose_boid_agent,
                keep_alive=True,
            ),
        ],
    )

    gen_scenario(scenario, output_dir=str(Path(__file__).parent))