Skip to content

Commit

Permalink
Working on #25. Tests updated. Updated several files.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomarnepedersen committed Apr 1, 2024
1 parent 3892fec commit 16e295b
Show file tree
Hide file tree
Showing 34 changed files with 240 additions and 210 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"title": "OT_GW",
"description": "A overtaking give-way situation. 5 different situations will be generated.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 7.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"numSituations": 5,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"title": "OT_GW, CR_GW",
"description": "Overtaking give-way and crossing give-way situations invoving tre ships. 4 different situations are generated.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 7.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"numSituations": 4,
Expand Down
4 changes: 3 additions & 1 deletion data/example_situations_input/example_situation_01_1_ts.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"title": "HO",
"description": "A head on situation with one target ship.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 10.0,
"cog": 270.0
"cog": 270.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
Expand Down
4 changes: 3 additions & 1 deletion data/example_situations_input/example_situation_02_1_ts.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"title": "CR-GW",
"description": "A crossing give-way situation with one target ship.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 10.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
Expand Down
4 changes: 3 additions & 1 deletion data/example_situations_input/example_situation_03_1_ts.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"title": "CR-SO",
"description": "A crossing stand-on situation with one target ship.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 10.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
Expand Down
4 changes: 3 additions & 1 deletion data/example_situations_input/example_situation_04_1_ts.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"title": "OT-GW",
"description": "An overtaking give-way situation with one target ship.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 7.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
Expand Down
2 changes: 0 additions & 2 deletions src/trafficgen/check_land_crossing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Module with helper functions to determine if a generated path is crossing land."""

from typing import List

from global_land_mask import globe
from maritime_schema.types.caga import Position

Expand Down
5 changes: 5 additions & 0 deletions src/trafficgen/encounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ def generate_encounter(
target_ship: TargetShip = TargetShip(
static=target_ship_static, initial=target_ship_initial, waypoints=None
)
else:
# Since encounter is not found, using initial values from own ship. Will not be taken into use.
target_ship: TargetShip = TargetShip(
static=target_ship_static, initial=own_ship.initial, waypoints=None
)
return target_ship, encounter_found


Expand Down
1 change: 0 additions & 1 deletion src/trafficgen/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from enum import Enum
from typing import List, Union
from unittest.mock import Base

from maritime_schema.types.caga import Initial
from pydantic import BaseModel
Expand Down
2 changes: 0 additions & 2 deletions src/trafficgen/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Utility functions that are used by several other functions."""

from typing import List

import numpy as np
from maritime_schema.types.caga import Position

Expand Down
9 changes: 5 additions & 4 deletions tests/data/test_01/test_01_1.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"title": "HO",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 10.0,
"cog": 270.0
"cog": 270.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "head-on",
"relativeSpeed": 1.2,
"vectorTime": 20.0
}
]
}
}
9 changes: 5 additions & 4 deletions tests/data/test_01/test_01_2.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"title": "OT-GW",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 12.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "overtaking-give-way",
"relativeSpeed": 0.6,
"vectorTime": 25.0
}
]
}
}
9 changes: 5 additions & 4 deletions tests/data/test_01/test_01_3.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"title": "OT-SO",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 8.0,
"cog": 110.0
"cog": 110.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "overtaking-stand-on",
"relativeSpeed": 1.5,
"vectorTime": 20.0
}
]
}
}
9 changes: 5 additions & 4 deletions tests/data/test_01/test_01_4.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"title": "CR-GW",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 8.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "crossing-give-way",
"relativeSpeed": 1.2,
"vectorTime": 20.0
}
]
}
}
9 changes: 5 additions & 4 deletions tests/data/test_01/test_01_5.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"title": "CR-SO",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 11.0,
"cog": 45.0
"cog": 45.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "crossing-stand-on",
"relativeSpeed": 1.4,
"vectorTime": 20.0
}
]
}
}
9 changes: 5 additions & 4 deletions tests/data/test_02/test_02_1.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"title": "HO",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 10.0,
"cog": 270.0
"cog": 270.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "head-on",
"vectorTime": 15.0
}
]
}
}
9 changes: 5 additions & 4 deletions tests/data/test_02/test_02_2.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"title": "OT-GW",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 8.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "overtaking-give-way",
"relativeSpeed": 0.6
}
]
}
}
9 changes: 5 additions & 4 deletions tests/data/test_03/test_03_1.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"title": "OT-GW",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 8.0,
"cog": 0.0
"cog": 0.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "overtaking-give-way"
}
]
}
}
9 changes: 5 additions & 4 deletions tests/data/test_03/test_03_2.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"title": "CR-SO",
"commonVector": 10.0,
"description": "Test situation.",
"ownShip": {
"initial": {
"position": {
"latitude": 58.763449,
"longitude": 10.490654
},
"sog": 12.0,
"cog": 230.0
"cog": 230.0,
"navStatus": "Under way using engine"
}
},
"encounter": [
"encounters": [
{
"desiredEncounterType": "crossing-stand-on"
}
]
}
}
Loading

0 comments on commit 16e295b

Please sign in to comment.