From 4b6e62cabea4a42e07e15d38c71cd44863f311ef Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Tue, 14 Mar 2023 09:34:33 +0100 Subject: [PATCH 1/1] Add gen obst at procedure --- scripts/generate_simple_json_scenario.py | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/scripts/generate_simple_json_scenario.py b/scripts/generate_simple_json_scenario.py index d6d3359..da1a483 100644 --- a/scripts/generate_simple_json_scenario.py +++ b/scripts/generate_simple_json_scenario.py @@ -134,6 +134,33 @@ def gen_slot(l=5.3, w=2.4): ] +def gen_obst_at(x, y, h): + """Generate obstacle at specific coordinates.""" + length = 0.5 + width = 0.5 + return [ + [ + x + width/2 * cos(h - pi/2) + length/2 * cos(h), + y + width/2 * sin(h - pi/2) + length/2 * sin(h), + ], + [ + x + width/2 * cos(h - pi/2) - length/2 * cos(h), + y + width/2 * sin(h - pi/2) - length/2 * sin(h), + ], + [ + x + width/2 * cos(h + pi/2) - length/2 * cos(h), + y + width/2 * sin(h + pi/2) - length/2 * sin(h), + ], + [ + x + width/2 * cos(h + pi/2) + length/2 * cos(h), + y + width/2 * sin(h + pi/2) + length/2 * sin(h), + ], + [ + x + width/2 * cos(h - pi/2) + length/2 * cos(h), + y + width/2 * sin(h - pi/2) + length/2 * sin(h), + ]] + + def gen_obst(): """Generate obstacles array.""" obstacles = [] -- 2.39.2