Add SOG to waypoint legs and fix target ship position bug - #83
Conversation
tomarnepedersen
commented
Nov 26, 2025
- Added sog to each waypoint leg. Updated documentation. Generated new baseline_situations_generated files. Updated types.
- Fixed bug where future position of target ship was used instead of initial position of target ship to check encounter evolvement. Updated documentation to make this functionality clearer.
- Added option to pass in a single input situation .json file, not only a folder.
…functionality with folder)
…ial ownship position and location of encounter
Add cli options: added option to read in a single situation file, added option to set ownship coordinate lat,lon as commandline argument, updated/extended README with testing instructions, added section to README on Contributing, fixed pydantic warning on definition of path_type, and added new tests for above functionality (single situation file, lat-lon argument).
…et ship instead of future position.
…e-encounter-has-evolved-initial-position-of-the-target-ship-should-be-used-instead-of-the-future-position Resolves #77, fixed bug, encounter evolvement is using initial position of target ship.
…-traffic-situation
…points-in-generated-traffic-situation Resolves #78 - Adding sog to waypoint legs for all vessels.
There was a problem hiding this comment.
Pull request overview
This PR adds SOG (Speed Over Ground) to waypoint legs, fixes a critical bug in encounter evolution checking, and enables passing a single .json file as input instead of requiring a folder.
Key changes:
- Added
sogfield to waypointLegtype and populated it throughout the codebase - Fixed bug where future target ship position was incorrectly used instead of initial position for encounter evolution validation
- Added support for reading single .json situation files (not just folders)
Reviewed changes
Copilot reviewed 72 out of 74 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/trafficgen/types.py |
Added sog field to Leg class; modified path_type default behavior |
src/trafficgen/encounter.py |
Fixed target ship position bug (line 190); added SOG to waypoint legs; added ownship coordinate override logic |
src/trafficgen/read_files.py |
Refactored to support single .json file input; extracted file reading logic |
src/trafficgen/ship_traffic_generator.py |
Added ownship coordinate CLI parameter with validation |
src/trafficgen/write_traffic_situation_to_file.py |
Added unit conversion for leg SOG from m/s to knots |
src/trafficgen/cli.py |
Added --ownship-coordinate option; improved help text |
tests/test_trafficgen.py |
Added test for ownship coordinate override feature |
tests/test_read_files.py |
Added test for single file reading |
tests/conftest.py |
Added situations_file fixture; fixed docstring typo |
docs/source/*.rst |
Clarified documentation for encounter evolution and added SOG examples |
pyproject.toml, CITATION.cff |
Version bump to 0.8.4; added Stephanie Kemna to contributors |
CHANGELOG.md |
Documented changes in version 0.8.4 |
README.md |
Added comprehensive contributing guidelines |
data/baseline_situations_generated/*.json |
Regenerated 55 baseline files with version 0.8.3→0.8.4 and added SOG to legs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| testers = [ | ||
| { name = "Grunde Løvoll", email = "Grunde.Lovoll@dnv.com" }, | ||
| { name = "Stephanie Kemna", email = "Stephanie.Kemna@dnv.com" }, | ||
| { name = "Stephanie Kemna"}, |
There was a problem hiding this comment.
Missing email address for Stephanie Kemna in the testers list, while it was present in the removed line. This creates an inconsistency in the contributor information.
| Field( | ||
| default=PathType.RTZ, | ||
| description=( | ||
| "Specifies the control-point model (e.g., Bezier, RTZ) " | ||
| "used to define the path for the ship to follow." | ||
| ), | ||
| ), |
There was a problem hiding this comment.
The field path_type is missing from the Field() constructor where the default was previously set with default=PathType.RTZ. Moving the default to the field definition without keeping it in the Field() can change validation behavior. The removed line should be restored: default=PathType.RTZ,
| { name = "Tom Arne Pedersen", email = "Tom.Arne.Pedersen@dnv.com" }, | ||
| { name = "Claas Rostock", email = "Claas.Rostock@dnv.com" }, | ||
| { name = "Minos Hemrich", email = "Minos.Hemrich@dnv.com" }, | ||
| { name = "Stephanie Kemna"} |
There was a problem hiding this comment.
Missing email address for Stephanie Kemna in the authors list. The other authors have email addresses specified, so this should be consistent.
|
Review allready done on dev branch |