Skip to content

Commit

Permalink
chore: rename config/simulations config/scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
kpbaks committed Sep 6, 2024
1 parent 27eff37 commit 6ea2372
Show file tree
Hide file tree
Showing 69 changed files with 70 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# environment = "junction"
environment_image = "empty"
environment = "./config/simulations/ClearCircle/environment.yaml"
formation_group = "./config/simulations/ClearCircle/formation.ron"
environment = "./config/scenarios/ClearCircle/environment.yaml"
formation_group = "./config/scenarios/ClearCircle/formation.ron"

[interaction]
ui-focus-cancels-inputs = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Intersection/environment.yaml"
formation_group = "./config/simulations/Intersection/formation.ron"
environment = "./config/scenarios/Intersection/environment.yaml"
formation_group = "./config/scenarios/Intersection/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Collaborative GP/environment.yaml"
formation_group = "./config/simulations/Collaborative GP/formation.ron"
environment = "./config/scenarios/Collaborative GP/environment.yaml"
formation_group = "./config/scenarios/Collaborative GP/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "circle_cluttered"
environment = "./config/simulations/Circle/environment.yaml"
formation_group = "./config/simulations/Circle/formation.ron"
environment = "./config/scenarios/Circle/environment.yaml"
formation_group = "./config/scenarios/Circle/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# environment = "junction"
environment_image = "circle_cluttered"
environment = "./config/simulations/Circle/environment.yaml"
formation_group = "./config/simulations/Circle/formation.ron"
environment = "./config/scenarios/Circle/environment.yaml"
formation_group = "./config/scenarios/Circle/formation.ron"

[interaction]
ui-focus-cancels-inputs = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "empty"
environment = "./config/simulations/ClearCircle/environment.yaml"
formation_group = "./config/simulations/ClearCircle/formation.ron"
environment = "./config/scenarios/ClearCircle/environment.yaml"
formation_group = "./config/scenarios/ClearCircle/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Intersection/environment.yaml"
formation_group = "./config/simulations/Intersection/formation.ron"
environment = "./config/scenarios/Intersection/environment.yaml"
formation_group = "./config/scenarios/Intersection/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Intersection/environment.yaml"
formation_group = "./config/simulations/Intersection/formation.ron"
environment = "./config/scenarios/Intersection/environment.yaml"
formation_group = "./config/scenarios/Intersection/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Merge/environment.yaml"
formation_group = "./config/simulations/Merge/formation.yaml"
environment = "./config/scenarios/Merge/environment.yaml"
formation_group = "./config/scenarios/Merge/formation.yaml"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ obstacles:
tile-coordinates:
row: 2
col: 3

- shape: !polygon
points:
- x: 0.0
Expand Down Expand Up @@ -336,4 +336,4 @@ obstacles:
y: 0.0
tile-coordinates:
row: 1
col: 3
col: 3
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ formations:
intersects-with: horizon
finished-when-intersects:
distance: !meter 40
intersects-with: current
intersects-with: current
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "circle_cluttered"
environment = "./config/simulations/Circle/environment.yaml"
formation_group = "./config/simulations/Circle/formation.ron"
environment = "./config/scenarios/Circle/environment.yaml"
formation_group = "./config/scenarios/Circle/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# environment = "junction"
environment_image = "empty"
environment = "./config/simulations/ClearCircle/environment.yaml"
formation_group = "./config/simulations/ClearCircle/formation.ron"
environment = "./config/scenarios/ClearCircle/environment.yaml"
formation_group = "./config/scenarios/ClearCircle/formation.ron"

[interaction]
ui-focus-cancels-inputs = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# environment = "junction"
environment_image = "junction_twoway"
environment = "./config/simulations/Intersection/environment.yaml"
formation_group = "./config/simulations/Intersection/formation.ron"
environment = "./config/scenarios/Intersection/environment.yaml"
formation_group = "./config/scenarios/Intersection/formation.ron"

[interaction]
ui-focus-cancels-inputs = true
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Complex/environment.yaml"
formation_group = "./config/simulations/Complex/formation.ron"
environment = "./config/scenarios/Complex/environment.yaml"
formation_group = "./config/scenarios/Complex/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Solo GP/environment.yaml"
formation_group = "./config/simulations/Solo GP/formation.ron"
environment = "./config/scenarios/Solo GP/environment.yaml"
formation_group = "./config/scenarios/Solo GP/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Intersection/environment.yaml"
formation_group = "./config/simulations/Intersection/formation.ron"
environment = "./config/scenarios/Intersection/environment.yaml"
formation_group = "./config/scenarios/Intersection/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Intersection/environment.yaml"
formation_group = "./config/simulations/Intersection/formation.ron"
environment = "./config/scenarios/Intersection/environment.yaml"
formation_group = "./config/scenarios/Intersection/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment_image = "junction_twoway"
environment = "./config/simulations/Intersection/environment.yaml"
formation_group = "./config/simulations/Intersection/formation.ron"
environment = "./config/scenarios/Intersection/environment.yaml"
formation_group = "./config/scenarios/Intersection/formation.ron"

[visualisation.height]
objects = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# environment = "junction"
environment_image = "circle_cluttered"
environment = "./config/simulations/Circle/environment.yaml"
formation_group = "./config/simulations/Circle/formation.ron"
environment = "./config/scenarios/Circle/environment.yaml"
formation_group = "./config/scenarios/Circle/formation.ron"

[interaction]
ui-focus-cancels-inputs = true
Expand Down
6 changes: 3 additions & 3 deletions crates/env_to_png/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ fn is_placeable_obstacle(
0.0
}
}
PlaceableShape::Polygon{ .. } => 0.0,
PlaceableShape::Polygon { .. } => 0.0,
_ => std::f32::consts::FRAC_PI_2,
};

Expand All @@ -324,8 +324,8 @@ fn is_placeable_obstacle(
let inside_placeable_shape = expanded_shape.inside(rotated);

// if matches!(obstacle.shape, PlaceableShape::Polygon{ .. }) {
// println!("Expanded shape: {:?}\nPoint: {:?}\nInside: {:?}", expanded_shape, translated, inside_placeable_shape);
// }
// println!("Expanded shape: {:?}\nPoint: {:?}\nInside: {:?}",
// expanded_shape, translated, inside_placeable_shape); }

if inside_placeable_shape {
return true;
Expand Down
21 changes: 9 additions & 12 deletions crates/gbp_environment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,12 @@ impl Polygon {
/// Expand the polygon's size by scaling around the average pointmass by
/// `expansion` as an addition
pub fn expanded(&self, expansion: Float) -> Self {

let point_center = {
let acc = self.points.clone().into_iter().fold([0.0, 0.0], |acc, p| {
[acc[0] + p.x, acc[1] + p.y]
});
let acc = self
.points
.clone()
.into_iter()
.fold([0.0, 0.0], |acc, p| [acc[0] + p.x, acc[1] + p.y]);

[
acc[0] / self.points.len() as Float,
Expand Down Expand Up @@ -408,16 +409,12 @@ impl Polygon {
/// rotation to be performed beforehand
pub fn inside(&self, point: Vec2) -> bool {
is_point_in_polygon(
(
point.x as f64,
point.y as f64
),
(point.x as f64, point.y as f64),
self.points
.iter()
.map(|relative_point| {
(relative_point.x, relative_point.y)
}).collect::<Vec<_>>()
.as_slice()
.map(|relative_point| (relative_point.x, relative_point.y))
.collect::<Vec<_>>()
.as_slice(),
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/magics/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ pub struct Cli {

// #[arg(short, long, value_name = "DIR")]
/// Path to directory with simuliations to load. [default:
/// ./config/simulations]
/// ./config/scenarios]
// #[arg(short, long, group = "configuration", default_value_t =
// String::from("./config/simulations"))]
// String::from("./config/scenarios"))]
#[arg(short, long, group = "configuration")]
pub simulations_dir: Option<std::path::PathBuf>,

Expand Down
2 changes: 1 addition & 1 deletion crates/magics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn main() -> anyhow::Result<()> {
}

if cli.list_scenarios {
let scenario_dir = Path::new("./config/simulations");
let scenario_dir = Path::new("./config/scenarios");
assert!(scenario_dir.exists());
let mut directories = Vec::new();
let entries = scenario_dir.read_dir()?; // .sort_by(|a, b| a.file_name().cmp(&b.file_name()));
Expand Down
4 changes: 2 additions & 2 deletions crates/magics/src/simulation_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use smol_str::SmolStr;
/// Which simulation to load initially
#[derive(Debug, Default)]
pub enum InitialSimulation {
/// Use the first simulation found in the `config/simulations` folder
/// Use the first simulation found in the `config/scenarios` folder
/// Ordered lexiographically
#[default]
FirstFoundInFolder,
Expand Down Expand Up @@ -64,7 +64,7 @@ pub struct Raw(pub RawImage);
// struct Simulations(BTreeMap<String, Simulation>);
type Simulations = BTreeMap<String, Simulation>;

const SIMULATIONS_DIR: &'static str = "./config/simulations";
const SIMULATIONS_DIR: &'static str = "./config/scenarios";

impl SimulationLoaderPlugin {
pub fn new(show_toasts: bool, initial_simulation: Option<String>) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-circle-expertiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function run
eval $argv
end

set -l config_file config/simulations/Circle\ Experiment/config.toml
set -l formation_file config/simulations/Circle\ Experiment/formation.yaml
set -l config_file config/scenarios/Circle\ Experiment/config.toml
set -l formation_file config/scenarios/Circle\ Experiment/formation.yaml

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' (set_color red) (set_color normal) $config_file >&2
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-collaborative-complex-experiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ end

set -l scenario 'Collaborative Complex'

set -l config_file config/simulations/$scenario/config.toml
set -l config_file config/scenarios/$scenario/config.toml

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' $red $reset $config_file >&2
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-collaborative-gp-experiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ set -l seeds 0 31 227 252 805
# --- Low Qin ---

set -l experiment "Collaborative GP"
set -l config_file "config/simulations/$experiment/config.toml"
set -l formation_file "config/simulations/$experiment/formation.yaml"
set -l config_file "config/scenarios/$experiment/config.toml"
set -l formation_file "config/scenarios/$experiment/formation.yaml"

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' (set_color red) (set_color normal) $config_file >&2
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-communication-failure-expertiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function run
eval $argv
end

set -l config_file config/simulations/Communications\ Failure\ Experiment/config.toml
set -l config_file config/scenarios/Communications\ Failure\ Experiment/config.toml

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' (set_color red) (set_color normal) $config_file >&2
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-environment-obstacles-experiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ set -l blue (set_color blue)
set -l cyan (set_color cyan)
set -l magenta (set_color magenta)

set -l config_file config/simulations/Environment\ Obstacles\ Experiment/config.toml
set -l formation_file config/simulations/Environment\ Obstacles\ Experiment/formation.yaml
set -l config_file config/scenarios/Environment\ Obstacles\ Experiment/config.toml
set -l formation_file config/scenarios/Environment\ Obstacles\ Experiment/formation.yaml

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' $red $reset $config_file >&2
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-iteration-amount-experiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function run
eval $argv
end

set -l config_file config/simulations/Iteration\ Amount\ Experiment/config.toml
set -l config_file config/scenarios/Iteration\ Amount\ Experiment/config.toml

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' (set_color red) (set_color normal) $config_file >&2
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-schedules-experiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ end

set -l experiment "Schedules Experiment"

set -l config_file "config/simulations/$experiment/config.toml"
set -l config_file "config/scenarios/$experiment/config.toml"

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' (set_color red) (set_color normal) $config_file >&2
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-solo-gp-experiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function run
end

set -l experiment "Solo GP"
set -l config_file "config/simulations/$experiment/config.toml"
set -l config_file "config/scenarios/$experiment/config.toml"

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' (set_color red) (set_color normal) $config_file >&2
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-structured-junction-twoway.fish
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function run
eval $argv
end

set -l config_file config/simulations/Structured\ Junction\ Twoway/config.toml
set -l config_file config/scenarios/Structured\ Junction\ Twoway/config.toml

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' (set_color red) (set_color normal) $config_file >&2
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-varying-network-connectivity-experiment.fish
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ set -l magenta (set_color magenta)

#'Varying Network Connectivity Experiment'

set -l config_file config/simulations/Varying\ Network\ Connectivity\ Experiment/config.toml
set -l formation_file config/simulations/Varying\ Network\ Connectivity\ Experiment/formation.yaml
set -l config_file config/scenarios/Varying\ Network\ Connectivity\ Experiment/config.toml
set -l formation_file config/scenarios/Varying\ Network\ Connectivity\ Experiment/formation.yaml

if not test -f $config_file
printf '%serror%s: %s does not exist!\n' $red $reset $config_file >&2
Expand Down

0 comments on commit 6ea2372

Please sign in to comment.