Simulator

The Python Module for Advanced Radar and Lidar Simulations

This module provides tools for simulating and analyzing radar and lidar systems in complex 3D environments. The module supports a wide range of functionalities, including:

  1. Lidar Simulations:

    • Simulate Lidar systems in dynamic or static 3D environments.

    • Generate point clouds and compute ray interactions with targets.

    • Model the dynamics of targets, such as motion and rotation.

  2. Radar Simulations:

    • Simulate radar baseband responses for complex scenes.

    • Handle point targets, 3D mesh objects, interference modeling, and noise simulation.

    • Perform advanced ray-tracing for high-fidelity radar analysis.

  3. Radar Cross Section (RCS) Calculations:

    • Calculate the RCS of targets using the Shooting and Bouncing Rays (SBR) method.

    • Model electromagnetic wave scattering from complex 3D geometries.

    • Support for defining target materials and permittivity properties.

██████╗  █████╗ ██████╗  █████╗ ██████╗ ███████╗██╗███╗   ███╗██╗  ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║████╗ ████║╚██╗██╔╝
██████╔╝███████║██║  ██║███████║██████╔╝███████╗██║██╔████╔██║ ╚███╔╝ 
██╔══██╗██╔══██║██║  ██║██╔══██║██╔══██╗╚════██║██║██║╚██╔╝██║ ██╔██╗ 
██║  ██║██║  ██║██████╔╝██║  ██║██║  ██║███████║██║██║ ╚═╝ ██║██╔╝ ██╗
╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝╚═╝     ╚═╝╚═╝  ╚═╝
radarsimpy.simulator.sim_lidar(lidar, targets, frame_time=0)

Simulate a Lidar scene and compute ray interactions with targets.

This function simulates a Lidar scanning scene in a 3D environment, calculating the interaction of Lidar rays with the provided targets. It handles both static and dynamic targets, allowing for customizable positions, velocities, and orientations of objects in the scene. The simulation produces a set of rays representing the Lidar’s perception of the environment.

Parameters:
  • lidar (dict) –

    Lidar configuration parameters. The following keys are required:

    • position (numpy.ndarray): The 3D position of the Lidar in meters (m), specified as [x, y, z].

    • phi (numpy.ndarray): Array of phi scanning angles in degrees (°). Phi represents the horizontal scanning angles in the Lidar’s field of view. The total number of scanning directions is determined by the combination of phi and theta angles.

    • theta (numpy.ndarray): Array of theta scanning angles in degrees (°). Theta represents the vertical scanning angles in the Lidar’s field of view. The total number of scanning directions is computed as: len(phi) * len(theta).

  • targets (list[dict]) –

    A list of target objects in the scene. Each target is represented as a dictionary containing the following keys:

    • model (str): File path to the target model (3D object) in the scene.

    • origin (numpy.ndarray): The origin position (rotation and translation center) of the target model in meters (m), specified as [x, y, z]. Default: [0, 0, 0].

    • location (numpy.ndarray): The 3D location of the target in meters (m), specified as [x, y, z]. Default: [0, 0, 0].

    • speed (numpy.ndarray): Speed vector of the target in meters per second (m/s), specified as [vx, vy, vz]. Default: [0, 0, 0].

    • rotation (numpy.ndarray): The angular orientation of the target in degrees (°), specified as [yaw, pitch, roll]. Default: [0, 0, 0].

    • rotation_rate (numpy.ndarray): The angular rotation rate of the target in degrees per second (°/s), specified as [yaw rate, pitch rate, roll rate]. Default: [0, 0, 0].

    • unit (str): The unit system for the target model’s geometry. Supported values: mm, cm, m. Default: m.

  • frame_time (float) – Simulation timestamp in seconds (s). This parameter determines the time reference for the Lidar’s scanning operation and target positions. Default: 0.

Returns:

Simulated Lidar rays based on the provided configuration and targets.

Return type:

numpy.ndarray - A structured array representing the Lidar ray interactions with the scene, including details such as ray origins, directions, and intersections.

radarsimpy.simulator.sim_radar(radar, targets, frame_time=0, density=1, level=None, log_path=None, ray_filter=None, debug=False, interf=None)

Simulates the radar’s baseband response for a given scene.

This function generates the radar’s baseband response using the provided radar configuration and target data. It supports both ideal point targets and 3D mesh objects, and allows for varying levels of fidelity in the simulation. Additional options include interference modeling, ray density specification, and logging of simulation data.

Parameters:
  • radar (Radar) – The radar object to be used for the simulation.

  • targets (list) –

    The list of targets in the scene. Targets can be either ideal point targets or 3D mesh objects.

    • 3D Mesh Target: A target represented as a 3D model. Each target is defined as a dictionary with the following keys:

      • model (str): Path to the target model file.

      • origin (numpy.ndarray): Origin position (rotation and translation center) of the target model [x, y, z] in meters. Default: [0, 0, 0].

      • location (numpy.ndarray): Location of the target in meters [x, y, z]. Default: [0, 0, 0].

      • speed (numpy.ndarray): Target velocity in meters per second [vx, vy, vz]. Default: [0, 0, 0].

      • rotation (numpy.ndarray): Target orientation in degrees [yaw, pitch, roll]. Default: [0, 0, 0].

      • rotation_rate (numpy.ndarray): Target’s angular velocity in degrees per second [yaw rate, pitch rate, roll rate]. Default: [0, 0, 0].

      • permittivity (complex): Target’s permittivity. Defaults to a perfect electric conductor (PEC).

      • unit (str): Unit of the target model. Supported values: mm, cm, m. Default: m.

    • Ideal Point Target: A simplified target defined as a point in space. Each target is represented as a dictionary with the following keys:

      • location (numpy.ndarray): Target location in meters [x, y, z].

      • rcs (float): Target’s radar cross-section (RCS) in dBsm.

      • speed (numpy.ndarray): Target velocity in meters per second [vx, vy, vz]. Default: [0, 0, 0].

      • phase (float): Target phase in degrees. Default: 0.

    Note: Target parameters can be time-varying by using Radar.timestamp. For example: location = (1e-3 * np.sin(2 * np.pi * 1 * radar.timestamp), 0, 0)

  • frame_time (float or list) – Radar firing times or frame instances, specified as a float or a list of time values. Default: 0.

  • density (float) – Ray density, defined as the number of rays per wavelength. Default: 1.0.

  • level (str or None) –

    Fidelity level of the simulation. Default: None.

    • None: Perform one ray-tracing simulation for the entire frame.

    • pulse: Perform ray-tracing for each pulse.

    • sample: Perform ray-tracing for each sample.

  • log_path (str or None) – Path to save ray-tracing data. Default: None (does not save data).

  • ray_filter (list or None) – Filters rays based on the number of reflections. Only rays with the number of reflections between ray_filter[0] and ray_filter[1] are included in the calculations. Default: None (no filtering).

  • debug (bool) – Whether to enable debug mode. Default: False.

  • interf (Radar or None) – Interference radar object. Default: None.

Returns:

A dictionary containing the simulated baseband response and related data:

  • baseband (numpy.ndarray): Time-domain baseband data with shape [channels/frames, pulses, samples]. The channel/frame order is as follows (with K frames, M Tx channels and N Rx channels):

    • [0, :, :] Frame[0] Tx[0] Rx[0]

    • [1, :, :] Frame[0] Tx[0] Rx[1]

    • [N-1, :, :] Frame[0] Tx[0] Rx[N-1]

    • [N, :, :] Frame[0] Tx[1] Rx[0]

    • [M·N-1, :, :] Frame[0] Tx[M-1] Rx[N-1]

    • [M·N, :, :] Frame[1] Tx[0] Rx[0]

    • [K·M·N-1, :, :] Frame[K-1] Tx[M-1] Rx[N-1]

  • noise (numpy.ndarray): Time-domain noise data with the same shape and order as baseband.

  • interference (numpy.ndarray): Time-domain interference data (if applicable), with the same shape and order as baseband.

  • timestamp (numpy.ndarray): Timestamp array, directly derived from Radar.timestamp.

Return type:

dict

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

Calculate the Radar Cross Section (RCS) of targets using the Shooting and Bouncing Rays (SBR) method.

This function computes the RCS of one or more targets by simulating how electromagnetic waves interact with the target models. The simulation uses the SBR technique, which accurately models wave scattering by tracing rays that shoot at the target and bounce off its surfaces.

Parameters:
  • targets (list[dict]) –

    A list of target dictionaries specifying the properties of each target. Each dictionary contains the following keys:

    • model (str): File path to the 3D target model.

    • origin (numpy.ndarray): The origin position (rotation and translation center) of the target model in meters (m), specified as [x, y, z]. Default: [0, 0, 0].

    • location (numpy.ndarray): The 3D location of the target in meters (m), specified as [x, y, z]. Default: [0, 0, 0].

    • rotation (numpy.ndarray): The target’s orientation in degrees (°), specified as [yaw, pitch, roll]. Default: [0, 0, 0].

    • permittivity (complex): The target’s permittivity, which represents its electromagnetic material properties. Default: Perfect Electric Conductor (PEC).

    • unit (str): Unit of measurement for the target model’s geometry. Supported values: mm, cm, m. Default: m.

  • f (float) – The center frequency of the incident electromagnetic wave in Hertz (Hz).

  • inc_phi (float) – The horizontal incidence angle (phi) of the incoming wave in degrees (°). This angle is measured relative to the target at the transmitter’s point of view.

  • inc_theta (float) – The vertical incidence angle (theta) of the incoming wave in degrees (°). This angle is measured relative to the target at the transmitter’s point of view.

  • inc_pol (list[float]) – The polarization of the incident wave, specified as a 3D vector [x, y, z]. Default: [0, 0, 1] (vertical polarization).

  • obs_phi (float) – The horizontal observation angle (phi) in degrees (°). This is the angle at which the RCS is observed from the observer’s point of view. Default: None (if not specified, it is set to the same value as inc_phi).

  • obs_theta (float) – The vertical observation angle (theta) in degrees (°). This is the angle at which the RCS is observed from the observer’s point of view. Default: None (if not specified, it is set to the same value as inc_theta).

  • obs_pol (list[float]) – The polarization of the observer, specified as a 3D vector [x, y, z]. Default: None (if not specified, it is set to the same value as inc_pol).

  • density (float) – The ray density, defined as the number of rays per wavelength. Higher ray density improves accuracy but increases computational cost. Default: 1.0.

Returns:

The Radar Cross Section (RCS) of the target(s) in square meters (m²). To convert the result to decibels relative to one square meter (dBsm), use: 10 * log10(RCS).

Return type:

float