Skip to content

Commit e463f17

Browse files
author
razvancruceanu
committed
Add initial grid to real-world transformation
1 parent e275c4e commit e463f17

File tree

4 files changed

+347
-340
lines changed

4 files changed

+347
-340
lines changed

ships_hybrid_algorithm/agents/ship.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,29 +102,6 @@ def get_noisy_speed(self):
102102
# Clamp to valid range
103103
noisy_speed = max(self.dwa_config["min_speed"], min(noisy_speed, self.dwa_config["max_speed"]))
104104
return noisy_speed
105-
106-
def get_noisy_state(self):
107-
# Randomly trigger heading deviation
108-
if self.heading_drift_duration > 0:
109-
# Continue existing deviation
110-
noisy_theta = self.state[2] + self.heading_deviation
111-
self.heading_drift_duration -= 1
112-
logging.info(f"Continue deviation. Ship {self.unique_id}, Theta = {self.heading_deviation}")
113-
else:
114-
# Random chance to start a new deviation
115-
if self.random.random() < self.model.deviation_chance:
116-
self.heading_deviation = self.random.uniform(-self.model.max_heading_deviation, self.model.max_heading_deviation)
117-
self.heading_drift_duration = self.model.deviation_duration
118-
noisy_theta = self.state[2] + self.heading_deviation
119-
logging.info(f"Starting directional deviation. Ship {self.unique_id}, Theta = {self.heading_deviation}")
120-
else:
121-
noisy_theta = self.state[2]
122-
123-
# Normalize heading
124-
noisy_theta = (noisy_theta + math.pi) % (2 * math.pi) - math.pi
125-
noisy_state = (self.state[0], self.state[1], noisy_theta, self.state[3], self.state[4])
126-
127-
return noisy_state
128105

129106
def should_dock(self, current_speed):
130107
"""Determine if the ship should dock at its destination."""

ships_hybrid_algorithm/config/config.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"simulation_steps": 3000,
2+
"simulation_steps": 1500,
33
"width": 100,
44
"height": 100,
55
"num_ships": 35,
@@ -57,6 +57,13 @@
5757
[[75, 75], [78, 73], [82, 76], [80, 80], [76, 79]],
5858
[[27, 28], [35, 27], [38, 29], [39, 32], [37, 36], [32, 39], [28, 37], [26, 33]]
5959
],
60+
"geospatial_bounds": {
61+
"min_lat": 20.0,
62+
"max_lat": 40.0,
63+
"min_lon": 0.0,
64+
"max_lon": 20.0
65+
},
66+
"time_step_seconds": 0.001,
6067
"dwa_config": {
6168
"max_speed": 1.0,
6269
"min_speed": 0.1,

0 commit comments

Comments
 (0)