|
| int | spec_dim (str spec) |
| |
| str | spec_base (str spec) |
| |
| bool | spec_uncertain (str spec) |
| |
| int | seconds_to_steps (float seconds, float dt) |
| |
| STLFormula | outside_box (float half_width, int d=2, tuple[int,...]|None axes=None) |
| |
| STLFormula | interval_outside_box (float half_width, int d=2, tuple[int,...]|None axes=None, float offset_bound=0.05, float rotation_bound=0.05) |
| |
| STLFormula | rotated_outside_box (float half_width, np.ndarray R, int|None d=None, tuple[int,...]|None axes=None) |
| |
| np.ndarray | rotation_matrix (np.ndarray axis, float angle) |
| |
| STLFormula | outside_square (float half_width, int d=2, int ix=0, int iy=1) |
| |
| STLFormula | window_spec (STLFormula psi, int n_plan, int first_window=0) |
| |
| int | first_enforced_window (int t, int h) |
| |
NAHS patrol task: keep-out square, formulas (24)/(25), receding window specification.
Baird, Morales-Cuadrado and Coogan (NAHS 2026 submission, Sec. 11):
theta = (x in S) => F_[0,4] (x notin S) (24)
phi = (x in S) => F_[0,3] G_[0,1] (x notin S) (25)
with time bounds in seconds and ``S = {|px| < 1.41, |py| < 1.41}`` (2 m taped square
inflated by the 0.38 m blimp radius and the 0.03 m tape). The reference code
(`rta_fixed.py:395-397`) converts seconds to steps as ``F_[0, round(4/dt) - 1]`` and
``F_[0, round(3/dt) - 1] G_[0, round(1/dt)]``; :func:`seconds_to_steps` follows that
convention so that ``dt = 0.5`` reproduces their 7-step formulas exactly.
``(x in S) => F_[0,a] notS`` equals ``notS OR F_[0,a] notS = F_[0,a] notS`` (the
eventually includes offset 0), so theta is built as the eventually alone. phi keeps
the disjunction (``notS`` now does not imply ``F G notS``).
The signal is the planar position ``y = (px, py)``; every predicate is
``+-px - 1.41 >= 0`` or ``+-py - 1.41 >= 0`` (unit normals, robustness in metres).
3-D cube variants (theta^+, phi^+)
---------------------------------
``theta_plus`` and ``phi_plus`` keep the temporal structure of (24)/(25) and replace the square by
the cube ``S+ = {|px|, |py|, |pz| < 1.41}`` (signal ``y = (px, py, pz)``, z relative to the cube
centre). The patrol waypoints are the six face centres moved outward by the 2-D offset
(``waypoint_radius - half_width``), visited in the order ``+y, +x, +z, -y, -x, -z``: consecutive
faces are adjacent, so each straight leg cuts an edge region of ``S+`` as the 2-D legs cut the
corners of ``S``. Restricted to the plane the cycle is the 2-D order ``+y, +x, -y, -x``.
Uncertain predicates (theta_u, phi_u, theta_plus_u, phi_plus_u)
---------------------------------------------------------------
The ``_u`` specs keep the temporal structure and the signal of their exact counterpart and replace
every face predicate by an interval predicate ``[a]^T y - [b] >= 0``
(:class:`~rl_stl.stl.interval.IntervalPredicate`). The true keep-out region is the nominal square
(cube) rotated by an unknown angle of at most ``pred_rotation`` (0.05 rad, any axis in 3-D) about its
centre, with an unknown half-width ``b in [half_width - pred_offset, half_width + pred_offset]``
(0.05 m). ``[b]`` is that interval; ``[a]`` is the interval hull of the face's rotated unit normal:
for the ``+x`` face ``a_x in [cos(pred_rotation), 1]`` and every tangential component in
``[-sin(pred_rotation), sin(pred_rotation)]`` (signs flipped for the ``-`` faces). Every true region
is therefore inside the predicates' uncertainty set, and the I-STL lower bound
(:mod:`rl_stl.stl.interval`) is a worst case over all of them.
``PatrolTask.nominal_predicates`` is an ablation: the loop plans and checks with the exact nominal
predicates while the episode is scored against a true region drawn inside the uncertainty set
(:meth:`PatrolTask.sample_true_region`, :meth:`PatrolTask.true_formula`).
Receding window
---------------
At planning step ``t`` the synthesis signal is ``y_{t-h+1} .. y_t`` (measured) followed
by ``y_{t+1} .. y_{t+N}`` (planned), ``L = h + N`` samples, where ``h`` is the formula
horizon. The formula is enforced on every window ``[s, s+h]`` that contains a planned
sample: local starts ``s = 0 .. N-1`` (NAHS (16): ``k = t-h+1 .. t+N-h``). Windows that
would start before the episode start are not enforced (:func:`window_spec`).