From: Jiri Vlasak Date: Tue, 14 Mar 2023 08:34:33 +0000 (+0100) Subject: Add gen obst at procedure X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/iamcar2.git/commitdiff_plain/4b6e62cabea4a42e07e15d38c71cd44863f311ef Add gen obst at procedure --- 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 = []