riskenv
riskenv computes the Risk Envelope — a convex hull bounding all collision-risk regions around an agent given a set of moving obstacles. It is designed for real-time motion planning in dynamic environments and works in both 2D and 3D spatial contexts across any application domain (autonomous vessels, ground robots, UAVs, etc.).
The Risk Envelope is defined by three filtering criteria (Indices of Interest I1, I2, I3) derived from closest-point-of-approach (CPA) geometry, and is returned as a set of convex hull vertices ready for use in a downstream planner.
Table of Contents
Installation
pip install riskenv
Requires Python ≥ 3.10.
Usage
Minimal example
import math
from riskenv import create_unsafe_set, Agent, Obstacle
agent = Agent(
position=(10.0, 10.0), # (x, y) or (x, y, z) in metres
heading=0.0, # yaw angle in radians
speed=15.0, # m/s
yaw_rate=0.2, # rad/s
safety_radius=5.0, # metres
)
obstacles = [
Obstacle(
position=(30.0, 20.0),
heading=math.pi, # facing along -x axis
speed=20.0,
yaw_rate=0.1,
safety_radius=10.0,
tag='vessel_a',
),
]
# dsf: distance safety factor (metres) — the proximity threshold for I1/I2/I3
# time_of_interest: TCPA horizon in seconds for the I3 filter (default 15 s)
# Returns: list of [x, y] hull vertices, or [] if no risk region exists.
vertices = create_unsafe_set(agent=agent, obstacles=obstacles, dsf=10.0)
Quaternion users
Convert to a heading angle before constructing Agent or Obstacle:
from riskenv import heading_from_quaternion
heading = heading_from_quaternion(qx, qy, qz, qw)
Lower-level API
All internal building blocks are importable directly from the top-level package:
from riskenv import (
calc_cpa, # DCPA / TCPA for a single obstacle
calculate_obstacle_metrics_for_agent, # annotate all obstacles with CPA metrics
predict_position, # dead-reckoning position at time dt
calc_I1, calc_I2, calc_I3, # individual index-of-interest filters
unionise_indices_of_interest, # merge I1 / I2 / I3 without duplicates
gen_uIoI_convhull, # convex hull from a union set
ObstacleWithMetrics, # Obstacle + tcpa/dcpa container
)
CPA metric summary
| Case | v_rel_norm_sq | p_rel == [0, 0] | tcpa > 0 | DCPA | TCPA |
|---|---|---|---|---|---|
| 1.1 Identical position, same velocity | < 1e-6 | ✅ | – | NaN | inf |
| 1.2 Zero relative velocity, offset | < 1e-6 | ❌ | – | ‖p_rel‖ | ‖p_rel‖ / ‖v1‖ (or inf) |
| 2.1 Future CPA | ≥ 1e-6 | – | ✅ | ‖p_rel + tcpa · v_rel‖ | computed tcpa |
| 2.2 CPA in past or at t=0 | ≥ 1e-6 | – | ❌ | NaN | NaN |
Structure
src/riskenv/
├── objects/ — Agent, Obstacle, ObstacleWithMetrics
├── risk_assessment/ — calc_cpa, heading_from_quaternion, calculate_obstacle_metrics_for_agent
├── indices_of_interest/ — calc_I1, calc_I2, calc_I3, unionise_indices_of_interest
├── collision_geometry/ — gen_uIoI_convhull
├── position_prediction/ — predict_position
└── unsafe_set/ — create_unsafe_set (top-level orchestrator)
References
This package implements the Risk Envelope method for motion planning originally described in:
R. McKee, N. Athanasopoulos, W. Naeem, "Geometric Motion Planning in Dynamic Environments" — (citation pending publication)
License
riskenv is distributed under the terms of the MIT license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file riskenv-1.0.0.tar.gz.
File metadata
- Download URL: riskenv-1.0.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c1cb195a221a18569745482c22e749d400f782047d2dc4fa9abd5745882dce3
|
|
| MD5 |
a1fe196eb85f768616664e3192217660
|
|
| BLAKE2b-256 |
100df4725de8d7c3aaa3e873d250b03fdda892aff239285e65d951f09a52e1a1
|
Provenance
The following attestation bundles were made for riskenv-1.0.0.tar.gz:
Publisher:
workflow.yml on rymc-dev/riskenv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
riskenv-1.0.0.tar.gz -
Subject digest:
9c1cb195a221a18569745482c22e749d400f782047d2dc4fa9abd5745882dce3 - Sigstore transparency entry: 2395069377
- Sigstore integration time:
-
Permalink:
rymc-dev/riskenv@5ebe779c303373d5a03d04005644895d5ae40a54 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/rymc-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@5ebe779c303373d5a03d04005644895d5ae40a54 -
Trigger Event:
release
-
Statement type:
File details
Details for the file riskenv-1.0.0-py3-none-any.whl.
File metadata
- Download URL: riskenv-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b3f62aa474424595ea1150ba8799fafc1a4e4671baaea6f8d70ce5f44a1e427
|
|
| MD5 |
461196fbcf854132c0eac1e7482515d0
|
|
| BLAKE2b-256 |
d0176cf129859dbcf6a80b4fb0fedaa1c9a519d580face72f71edbb4f41bdfae
|
Provenance
The following attestation bundles were made for riskenv-1.0.0-py3-none-any.whl:
Publisher:
workflow.yml on rymc-dev/riskenv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
riskenv-1.0.0-py3-none-any.whl -
Subject digest:
5b3f62aa474424595ea1150ba8799fafc1a4e4671baaea6f8d70ce5f44a1e427 - Sigstore transparency entry: 2395070021
- Sigstore integration time:
-
Permalink:
rymc-dev/riskenv@5ebe779c303373d5a03d04005644895d5ae40a54 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/rymc-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@5ebe779c303373d5a03d04005644895d5ae40a54 -
Trigger Event:
release
-
Statement type: