Source code for pNeuma_simulator.gang.navigation

from math import exp

import numpy as np
from numba import jit
from numpy import argmin, argwhere, array
from scipy.signal import find_peaks

from pNeuma_simulator import params
from pNeuma_simulator.gang import collisions
from pNeuma_simulator.gang.neighborhood import neighborhood
from pNeuma_simulator.gang.particle import Particle






[docs] @jit(nopython=True) def decay(speed: float, theta: float) -> np.ndarray: """ Calculate the choice set for a given speed and angle. Args: speed (float): The speed value. theta (float): The angle value. Returns: alphas (ndarray): An array of angles in radians. """ gamma_max = round(exp(params.XM * speed * params.factor + params.CM) / params.da) * params.da # angular resolution in the reference system of the road gamma = np.linspace(gamma_max, -gamma_max, int(2 * gamma_max / params.da) + 1) # in the reference system of the agent alphas = np.radians(gamma) - theta return alphas