From fb431935c7dc87386d71f555f7501c9a318e5500 Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Mon, 3 Feb 2020 14:53:07 +0100 Subject: [PATCH] Randomized slot at 20m radius --- scripts/generate_simple_json_scenario.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/generate_simple_json_scenario.py b/scripts/generate_simple_json_scenario.py index 5eb0a88..0e7f629 100644 --- a/scripts/generate_simple_json_scenario.py +++ b/scripts/generate_simple_json_scenario.py @@ -10,7 +10,7 @@ The scenario contains at least: """ from json import dumps, loads from math import cos, pi, sin -from random import random +from random import random, uniform W = 1.625 WB = 2.450 @@ -32,14 +32,11 @@ def gen_slot(l=5.3, w=2.4): ol = l l = w w = ol - coord_min = 2 * MTR - coord_max = 20 - coord_dif = coord_max - coord_min - x = random() * coord_dif + coord_min - x *= -1 if random() < 0.5 else 1 - y = random() * coord_dif + coord_min - y *= -1 if random() < 0.5 else 1 - h = random() * 2 * pi + r = 20 + angl = uniform(0, 2 * pi) + x = r * cos(angl) + y = r * sin(angl) + h = uniform(0, 2 * pi) if parallel: return [[ [ -- 2.39.2