Raytracing

A Python module for radar simulation

██████╗  █████╗ ██████╗  █████╗ ██████╗ ███████╗██╗███╗   ███╗██╗  ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║████╗ ████║╚██╗██╔╝
██████╔╝███████║██║  ██║███████║██████╔╝███████╗██║██╔████╔██║ ╚███╔╝ 
██╔══██╗██╔══██║██║  ██║██╔══██║██╔══██╗╚════██║██║██║╚██╔╝██║ ██╔██╗ 
██║  ██║██║  ██║██████╔╝██║  ██║██║  ██║███████║██║██║ ╚═╝ ██║██╔╝ ██╗
╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝╚═╝     ╚═╝╚═╝  ╚═╝
radarsimpy.rt.lidar_scene(lidar, targets, t=0)

Lidar scene simulator

Parameters:
  • lidar (dict) –

    Lidar configuration

    {

    • position (numpy.1darray) –

      Lidar’s position (m). [x, y, z]

    • phi (numpy.1darray) –

      Array of phi scanning angles (deg). The total sweep angles are the number of phi angles x the number of theta angles

    • theta (numpy.1darray) –

      Array of theta scanning angles (deg). The total sweep angles are the number of phi angles x the number of theta angles

    }

  • targets (list[dict]) –

    Target list

    [{

    • model (str) –

      Path to the target model

    • origin (numpy.1darray) –

      Origin position of the target model (m), [x, y, z]. default [0, 0, 0]

    • location (numpy.1darray) –

      Location of the target (m), [x, y, z]. default [0, 0, 0]

    • speed (numpy.1darray) –

      Speed of the target (m/s), [vx, vy, vz]. default [0, 0, 0]

    • rotation (numpy.1darray) –

      Target’s angle (deg), [yaw, pitch, roll]. default [0, 0, 0]

    • rotation_rate (numpy.1darray) –

      Target’s rotation rate (deg/s), [yaw rate, pitch rate, roll rate] default [0, 0, 0]

    • unit (str) –

      Unit of target model. Supports mm, cm, and m. Default is m.

    }]

  • t (float) – Simulation timestamp. default 0

Returns:

rays

Return type:

numpy.array

radarsimpy.rt.rcs_sbr(targets, f, inc_phi, inc_theta, inc_pol=[0, 0, 1], obs_phi=None, obs_theta=None, obs_pol=None, density=1)

Calculate target’s RCS by using shooting and bouncing rays (SBR)

Parameters:
  • targets (list[dict]) –

    Target list

    [{

    • model (str) –

      Path to the target model

    • origin (numpy.1darray) –

      Origin position of the target model (m), [x, y, z]. default [0, 0, 0]

    • location (numpy.1darray) –

      Location of the target (m), [x, y, z]. default [0, 0, 0]

    • rotation (numpy.1darray) –

      Target’s angle (deg), [yaw, pitch, roll]. default [0, 0, 0]

    • permittivity (complex) –

      Target’s permittivity. Perfect electric conductor (PEC) if not specified.

    • unit (str) –

      Unit of target model. Supports mm, cm, and m. Default is m.

    }]

  • f (float) – Center frequency (Hz)

  • inc_phi (float) – Incidence angle phi (deg).

  • inc_theta (float) – Incidence angle theta (deg).

  • inc_pol (list) – Incidence polarization [x, y, z]. default [0, 0, 1]

  • obs_phi (float) – Observation angle phi (deg) default None means obs_phi = inc_phi

  • obs_theta (float) – Observation angle theta (deg) default None means obs_theta = inc_theta

  • obs_pol (list) – Observer polarization [x, y, z]. default same as inc_pol

  • density (float) – Ray density (number of rays per wavelength). default 1

Returns:

Target’s RCS (m^2), use 10*log10(RCS) to convert to dBsm

Return type:

float

radarsimpy.rt.scene(radar, targets, density=1, level=None, log_path=None, debug=False, interf=None)

deprecated Please use simulator.sim_radar(radar, targets, density=1, level=None, log_path=None, debug=False, interf=None)

This function generates radar’s baseband response of a scene using the given radar and targets.

Parameters:
  • radar (Radar) – The radar object used for the scene.

  • targets (list) –

    The targets in the scene.

    [{

    • model (str) –

      Path to the target model

    • origin (numpy.1darray) –

      Origin position of the target model (m), [x, y, z]. default [0, 0, 0]

    • location (numpy.1darray) –

      Location of the target (m), [x, y, z]. default [0, 0, 0]

    • speed (numpy.1darray) –

      Speed of the target (m/s), [vx, vy, vz]. default [0, 0, 0]

    • rotation (numpy.1darray) –

      Target’s angle (deg), [yaw, pitch, roll]. default [0, 0, 0]

    • rotation_rate (numpy.1darray) –

      Target’s rotation rate (deg/s), [yaw rate, pitch rate, roll rate] default [0, 0, 0]

    • permittivity (complex) –

      Target’s permittivity. Perfect electric conductor (PEC) if not specified.

    • unit (str) –

      Unit of target model. Supports mm, cm, and m. Default is m.

    }]

    Note: Target’s parameters can be specified with Radar.timestamp to customize the time varying property. Example: location=(1e-3*np.sin(2*np.pi*1*radar.timestamp), 0, 0)

  • density (float) – Ray density. Number of rays per wavelength (default=1).

  • level (str or None) –

    Fidelity level of the simulation (default=None).

    • None: Perform one ray tracing simulation for the whole frame

    • pulse: Perform ray tracing for each pulse

    • sample: Perform ray tracing for each sample

  • log_path (str) – Provide the path to save ray data (default=None, no data will be saved).

  • debug (bool) – Whether to enable debug mode (default=False).

  • interf (Radar) – Interference radar (default=None).

Returns:

A dictionary containing the baseband data, timestamp, and interference (if available). {

  • baseband (numpy.3darray) –

    Time domain baseband data. [channes/frames, pulses, samples]

    Channel/frame order in baseband

    [0] Frame[0] -- Tx[0] -- Rx[0]

    [1] Frame[0] -- Tx[0] -- Rx[1]

    [N] Frame[0] -- Tx[1] -- Rx[0]

    [N+1] Frame[0] -- Tx[1] -- Rx[1]

    [M] Frame[1] -- Tx[0] -- Rx[0]

    [M+1] Frame[1] -- Tx[0] -- Rx[1]

  • noise (numpy.3darray) –

    Time domain noise data. [channes/frames, pulses, samples]

    Channel/frame order in baseband

    [0] Frame[0] -- Tx[0] -- Rx[0]

    [1] Frame[0] -- Tx[0] -- Rx[1]

    [N] Frame[0] -- Tx[1] -- Rx[0]

    [N+1] Frame[0] -- Tx[1] -- Rx[1]

    [M] Frame[1] -- Tx[0] -- Rx[0]

    [M+1] Frame[1] -- Tx[0] -- Rx[1]

  • interference (numpy.3darray) –

    Time domain interference data. [channes/frames, pulses, samples]

    Channel/frame order in baseband

    [0] Frame[0] -- Tx[0] -- Rx[0]

    [1] Frame[0] -- Tx[0] -- Rx[1]

    [N] Frame[0] -- Tx[1] -- Rx[0]

    [N+1] Frame[0] -- Tx[1] -- Rx[1]

    [M] Frame[1] -- Tx[0] -- Rx[0]

    [M+1] Frame[1] -- Tx[0] -- Rx[1]

  • timestamp (numpy.3darray) –

    Refer to Radar.timestamp

}

Return type:

dict