utils.checks#

Separate module for all checks used in the environments.

check_race_track(gates_pos: NDArray, nominal_gates_pos: NDArray, gates_quat: NDArray, nominal_gates_quat: NDArray, obstacles_pos: NDArray, nominal_obstacles_pos: NDArray, rng_config: ConfigDict)#

Check if the race track’s gates and obstacles are within tolerances.

Parameters:
  • gates_pos – The positions of the gates.

  • nominal_gates_pos – The nominal positions of the gates.

  • gates_quat – The orientations of the gates as quaternions.

  • nominal_gates_quat – The nominal orientations of the gates as quaternions.

  • obstacles_pos – The positions of the obstacles.

  • nominal_obstacles_pos – The nominal positions of the obstacles.

  • rng_config – Environment randomization config.

check_drone_start_pos(nominal_pos: NDArray, real_pos: NDArray, rng_config: ConfigDict, drone_name: str)#

Check if the real drone start position matches the settings.

Parameters:
  • nominal_pos – Nominal drone position.

  • real_pos – Current drone position.

  • rng_config – Environment randomization config.

  • drone_name – Name of the drone (e.g. cf10).

check_bounds(name: str, actual: NDArray, desired: NDArray, low: NDArray, high: NDArray)#

Check if the actual value is within the specified bounds of the desired value.

Parameters:
  • name – Name of the object being checked.

  • actual – Values to check.

  • desired – Reference values.

  • low – Lower bound. Minimum permissible value of (actual - desired).

  • high – Upper bound. Maximum value of (actual - desired).

Raises:

RuntimeError – The values are not in the permissible interval.

check_rotation(name: str, actual_rot: R, desired_rot: R, low: NDArray, high: NDArray)#

Compare gate orientations in world-frame Euler xyz.

Warning

Comparing Euler angles is tricky. While we try to sanitize the comparison as best as we can, edge cases may still cause failures.

Parameters:
  • name – Name of the object being checked.

  • actual_rot – R object describing rotation of the real object.

  • desired_rot – R object describing rotation of the nominal object.

  • low – Array designating the per axis rotation lower limit

  • high – Array designating the per axis rotation higher limit