def _map_mod_7(env):
    y_arr = [50, 200, 350, 500]

    for x in [200, 440]:
        for ind, i in enumerate(y_arr):
            origin = np.array([x, i])

            speed = _get_speed_for_speedmode(env.get_speed_mode())
            obs_mover = MovementPattern.CircleMovement(origin, 30, speed=speed)

            dynobs = DynamicObstacle(obs_mover)

            dynobs.radius = 50
            dynobs.shape = 1
            env.dynamic_obstacles.append(dynobs)

    for x in [300, 560]:
        for ind, i in enumerate(y_arr):
            origin = np.array([x, i])

            speed = _get_speed_for_speedmode(env.get_speed_mode())
            obs_mover = MovementPattern.RandomMovement(initial_pos=origin,
                                                       speed=speed)

            dynobs = DynamicObstacle(obs_mover)

            dynobs.size = [50, 50]
            dynobs.shape = 2
            env.dynamic_obstacles.append(dynobs)
def _map_mod_5(env):

    for i in range(1, 20):
        speed = _get_speed_for_speedmode(env.get_speed_mode())
        speed_args = _fixed_speed_kwargs(speed)
        dynobs = make_randompath_dynamic_obstacle(env,
                                                  radius_low=10,
                                                  radius_high=25,
                                                  **speed_args)
        env.dynamic_obstacles.append(dynobs)
    for j in np.arange(10):
        x = int(np.random.uniform(0, 800))
        y = int(np.random.uniform(0, 600))
        origin = np.array([x, y])

        speed = _get_speed_for_speedmode(env.get_speed_mode())
        obs_mover = MovementPattern.CircleMovement(origin, 30, speed=speed)

        dynobs = DynamicObstacle(obs_mover)

        dynobs.radius = int(np.random.uniform(10, 20))
        dynobs.shape = 1
        env.dynamic_obstacles.append(dynobs)
    for j in np.arange(10):
        x = int(np.random.uniform(0, 800))
        y = int(np.random.uniform(0, 600))
        origin = np.array([x, y])

        speed = _get_speed_for_speedmode(env.get_speed_mode())
        obs_mover = MovementPattern.RandomMovement(initial_pos=origin,
                                                   speed=speed)

        dynobs = DynamicObstacle(obs_mover)

        dynobs.size = [
            int(np.random.uniform(10, 20)),
            int(np.random.uniform(10, 20))
        ]
        dynobs.shape = 2
        env.dynamic_obstacles.append(dynobs)
def make_randompath_dynamic_obstacle(env,
                                     x_low=1,
                                     x_high=None,
                                     y_low=1,
                                     y_high=None,
                                     radius_low=5,
                                     radius_high=40,
                                     shape=1,
                                     speed_low=1.0,
                                     speed_high=9.0,
                                     num_path_points=50,
                                     path_x_low=1,
                                     path_x_high=None,
                                     path_y_low=1,
                                     path_y_high=None):
    x_high = env.width if x_high is None else x_high
    y_high = env.height if y_high is None else y_high
    path_x_high = env.width if path_x_high is None else path_x_high
    path_y_high = env.height if path_y_high is None else path_y_high

    speed = np.random.uniform(low=speed_low, high=speed_high)
    path_list = []
    for j in range(num_path_points):
        x_coord = int(np.random.uniform(path_x_low, path_x_high))
        y_coord = int(np.random.uniform(path_y_low, path_y_high))
        path_list.append((x_coord, y_coord))

    # For smooth looping, close the path
    path_list.append(path_list[0])

    obs_mover = MovementPattern.PathMovement(path_list, speed=speed, loop=True)

    dynobs = DynamicObstacle(obs_mover)

    dynobs.radius = int(np.random.uniform(radius_low, radius_high))
    dynobs.size = [dynobs.radius, dynobs.radius]
    dynobs.shape = shape

    return dynobs