From 30e56a6732048046a97496daa15ef00a9c4ff329 Mon Sep 17 00:00:00 2001 From: MikhailChaikovskii Date: Fri, 9 Aug 2024 14:09:08 +0300 Subject: [PATCH] add initial position --- rostok/simulation_chrono/simulation.py | 2 +- .../simulation_chrono/simulation_scenario.py | 7 +- tests_jupyter/robotic_rules_tutorial_py.py | 5 -- tests_jupyter/wheels_ruleset.ipynb | 86 ++++++++++++++++--- 4 files changed, 80 insertions(+), 20 deletions(-) diff --git a/rostok/simulation_chrono/simulation.py b/rostok/simulation_chrono/simulation.py index f1eca993..1019a9c1 100644 --- a/rostok/simulation_chrono/simulation.py +++ b/rostok/simulation_chrono/simulation.py @@ -32,7 +32,7 @@ def chrono_SMC_system(solver_iterations=100, return system @staticmethod - def chrono_NSC_system(solver_iterations=1000, force_tolerance=1e-4, gravity_list=[0, 0, 0]): + def chrono_NSC_system(solver_iterations=100, force_tolerance=1e-4, gravity_list=[0, 0, 0]): system = chrono.ChSystemNSC() system.SetSolverType(chrono.ChSolver.Type_BARZILAIBORWEIN) system.SetSolverMaxIterations(solver_iterations) diff --git a/rostok/simulation_chrono/simulation_scenario.py b/rostok/simulation_chrono/simulation_scenario.py index b30895ea..26fa2492 100644 --- a/rostok/simulation_chrono/simulation_scenario.py +++ b/rostok/simulation_chrono/simulation_scenario.py @@ -231,12 +231,15 @@ class SuspensionCarScenario(ParametrizedSimulation): def __init__(self, step_length, simulation_length, + initial_vertical_pos, controller_cls = ConstController, smc=False) -> None: super().__init__(step_length, simulation_length) self.event_builder_container: List[EventBuilder] = [] self.controller_cls = controller_cls self.smc = smc + self.initial_vertical_pos = initial_vertical_pos + def add_event_builder(self, event_builder): self.event_builder_container.append(event_builder) @@ -260,7 +263,7 @@ def run_simulation(self, if self.smc: system = ChronoSystems.chrono_SMC_system(gravity_list=[0, 0, 0]) else: - system = ChronoSystems.chrono_NSC_system(gravity_list=[0, -10, 0]) + system = ChronoSystems.chrono_NSC_system(solver_iterations=500, gravity_list=[0, -10, 0]) # setup the auxiliary env_creator = EnvCreator([]) vis_manager = ChronoVisManager(delay) @@ -284,7 +287,7 @@ def run_simulation(self, simulation.add_design(graph, controller_data, self.controller_cls, - Frame=FrameTransform([0, 0.25, 0], [0,0,0,1]), + Frame=FrameTransform([0, self.initial_vertical_pos, 0], [0,0,0,1]), starting_positions=starting_positions, is_fixed=False) # setup parameters for the data store diff --git a/tests_jupyter/robotic_rules_tutorial_py.py b/tests_jupyter/robotic_rules_tutorial_py.py index 3cedf25a..1ef9f18d 100644 --- a/tests_jupyter/robotic_rules_tutorial_py.py +++ b/tests_jupyter/robotic_rules_tutorial_py.py @@ -222,14 +222,9 @@ def rotation_z(alpha): n_steps = 10000 - - robot_data_dict = {} simulation.add_robot_data_type_dict(robot_data_dict) simulation.simulate(n_steps, 1e-3, 10000, [], vis_manager) #scenario.run_simulation(graph, control, starting_positions=[[0,0,-7,7], [0,0,-5,5], [0, 30, -60, -30, 60], [0, 30, -60, -30, 60]], vis = True, delay=True) - - - diff --git a/tests_jupyter/wheels_ruleset.ipynb b/tests_jupyter/wheels_ruleset.ipynb index 7870e634..cc5cab61 100644 --- a/tests_jupyter/wheels_ruleset.ipynb +++ b/tests_jupyter/wheels_ruleset.ipynb @@ -350,32 +350,94 @@ "cell_type": "code", "execution_count": 16, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Cannot use default video driver - fall back to OpenGL" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Irrlicht Engine version 1.8.5\n", + "Linux 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64\n", + "Using plain X visual\n", + "This driver is not available in Linux. Try OpenGL or Software renderer.\n", + "Irrlicht Engine version 1.8.5\n", + "Linux 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64\n", + "Using renderer: OpenGL 4.6\n", + "Mesa Intel(R) UHD Graphics 630 (CFL GT2): Intel\n", + "OpenGL driver version is 1.2 or better.\n", + "GLSL version: 4.6\n", + "Loaded texture: /home/be2r-lab-210134/Python/anaconda3/envs/rostok/share/chrono/data/fonts/arial80.bmp\n", + "Loaded texture: /home/be2r-lab-210134/Python/anaconda3/envs/rostok/share/chrono/data/skybox/sky_lf.jpg\n", + "Loaded texture: /home/be2r-lab-210134/Python/anaconda3/envs/rostok/share/chrono/data/skybox/sky_up.jpg\n", + "Loaded texture: /home/be2r-lab-210134/Python/anaconda3/envs/rostok/share/chrono/data/skybox/sky_dn.jpg\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n" + ] + }, + { + "ename": "ImportError", + "evalue": "You must be root to use this library on linux.", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[16], line 12\u001b[0m\n\u001b[1;32m 9\u001b[0m parameters[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mreverse_rotate\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0.2\u001b[39m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m#control = {\"initial_value\": [0.05]*2}\u001b[39;00m\n\u001b[0;32m---> 12\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mscenario\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_simulation\u001b[49m\u001b[43m(\u001b[49m\u001b[43mgraph\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstarting_positions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m45\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[38;5;241;43m90\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[38;5;241;43m90\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m90\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m90\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[38;5;241;43m90\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvis\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdelay\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/Python/rostok_project/code/main_rep/rostok/simulation_chrono/simulation_scenario.py:305\u001b[0m, in \u001b[0;36mSuspensionCarScenario.run_simulation\u001b[0;34m(self, graph, controller_data, starting_positions, vis, delay)\u001b[0m\n\u001b[1;32m 300\u001b[0m robot_data_dict \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 301\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCOG\u001b[39m\u001b[38;5;124m\"\u001b[39m: (SensorCalls\u001b[38;5;241m.\u001b[39mBODY_TRAJECTORY, SensorObjectClassification\u001b[38;5;241m.\u001b[39mBODY,\n\u001b[1;32m 302\u001b[0m SensorCalls\u001b[38;5;241m.\u001b[39mBODY_TRAJECTORY),\n\u001b[1;32m 303\u001b[0m }\n\u001b[1;32m 304\u001b[0m simulation\u001b[38;5;241m.\u001b[39madd_robot_data_type_dict(robot_data_dict)\n\u001b[0;32m--> 305\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msimulation\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mn_steps\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstep_length\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m10000\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mevent_list\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvis\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/Python/rostok_project/code/main_rep/rostok/simulation_chrono/simulation.py:320\u001b[0m, in \u001b[0;36mSingleRobotSimulation.simulate\u001b[0;34m(self, number_of_steps, step_length, fps, event_container, visualize)\u001b[0m\n\u001b[1;32m 318\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(number_of_steps):\n\u001b[1;32m 319\u001b[0m current_time \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mchrono_system\u001b[38;5;241m.\u001b[39mGetChTime()\n\u001b[0;32m--> 320\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msimulate_step\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstep_length\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcurrent_time\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mi\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 321\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresult\u001b[38;5;241m.\u001b[39mtime_vector\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mchrono_system\u001b[38;5;241m.\u001b[39mGetChTime())\n\u001b[1;32m 322\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m visualize:\n", + "File \u001b[0;32m~/Python/rostok_project/code/main_rep/rostok/simulation_chrono/simulation.py:269\u001b[0m, in \u001b[0;36mSingleRobotSimulation.simulate_step\u001b[0;34m(self, step_length, current_time, step_n)\u001b[0m\n\u001b[1;32m 266\u001b[0m robot\u001b[38;5;241m.\u001b[39mdata_storage\u001b[38;5;241m.\u001b[39mupdate_storage(step_n)\n\u001b[1;32m 268\u001b[0m \u001b[38;5;66;03m#controller gets current states of the robot and environment and updates control functions\u001b[39;00m\n\u001b[0;32m--> 269\u001b[0m \u001b[43mrobot\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcontroller\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupdate_functions\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcurrent_time\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrobot\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msensor\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 270\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menv_creator\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdata_storage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msensor\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39menv_creator\u001b[38;5;241m.\u001b[39mforce_torque_container\u001b[38;5;241m.\u001b[39mupdate_all(current_time,\n\u001b[1;32m 272\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39menv_creator\u001b[38;5;241m.\u001b[39mdata_storage\u001b[38;5;241m.\u001b[39msensor)\n", + "File \u001b[0;32m~/Python/rostok_project/code/main_rep/rostok/control_chrono/controller.py:96\u001b[0m, in \u001b[0;36mSimpleKeyBoardController.update_functions\u001b[0;34m(self, time, robot_data, environment_data)\u001b[0m\n\u001b[1;32m 92\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 93\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[0;32m---> 96\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43mkeyboard\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mis_pressed\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43ma\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 97\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m func, i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mzip\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfunctions, ordered_list_id):\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m right_wheel:\n", + "File \u001b[0;32m~/Python/anaconda3/envs/rostok/lib/python3.10/site-packages/keyboard/__init__.py:410\u001b[0m, in \u001b[0;36mis_pressed\u001b[0;34m(hotkey)\u001b[0m\n\u001b[1;32m 402\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mis_pressed\u001b[39m(hotkey):\n\u001b[1;32m 403\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 404\u001b[0m \u001b[38;5;124;03m Returns True if the key is pressed.\u001b[39;00m\n\u001b[1;32m 405\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 408\u001b[0m \u001b[38;5;124;03m is_pressed('ctrl+space') #-> True\u001b[39;00m\n\u001b[1;32m 409\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 410\u001b[0m \u001b[43m_listener\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstart_if_necessary\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 412\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m _is_number(hotkey):\n\u001b[1;32m 413\u001b[0m \u001b[38;5;66;03m# Shortcut.\u001b[39;00m\n\u001b[1;32m 414\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m _pressed_events_lock:\n", + "File \u001b[0;32m~/Python/anaconda3/envs/rostok/lib/python3.10/site-packages/keyboard/_generic.py:35\u001b[0m, in \u001b[0;36mGenericListener.start_if_necessary\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 33\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 34\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlistening:\n\u001b[0;32m---> 35\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minit\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 37\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlistening \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m 38\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlistening_thread \u001b[38;5;241m=\u001b[39m Thread(target\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlisten)\n", + "File \u001b[0;32m~/Python/anaconda3/envs/rostok/lib/python3.10/site-packages/keyboard/__init__.py:196\u001b[0m, in \u001b[0;36m_KeyboardListener.init\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 195\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minit\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 196\u001b[0m \u001b[43m_os_keyboard\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minit\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mactive_modifiers \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mset\u001b[39m()\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mblocking_hooks \u001b[38;5;241m=\u001b[39m []\n", + "File \u001b[0;32m~/Python/anaconda3/envs/rostok/lib/python3.10/site-packages/keyboard/_nixkeyboard.py:113\u001b[0m, in \u001b[0;36minit\u001b[0;34m()\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minit\u001b[39m():\n\u001b[0;32m--> 113\u001b[0m \u001b[43mbuild_device\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 114\u001b[0m build_tables()\n", + "File \u001b[0;32m~/Python/anaconda3/envs/rostok/lib/python3.10/site-packages/keyboard/_nixkeyboard.py:109\u001b[0m, in \u001b[0;36mbuild_device\u001b[0;34m()\u001b[0m\n\u001b[1;32m 107\u001b[0m \u001b[38;5;28;01mglobal\u001b[39;00m device\n\u001b[1;32m 108\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m device: \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[0;32m--> 109\u001b[0m \u001b[43mensure_root\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 110\u001b[0m device \u001b[38;5;241m=\u001b[39m aggregate_devices(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mkbd\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", + "File \u001b[0;32m~/Python/anaconda3/envs/rostok/lib/python3.10/site-packages/keyboard/_nixcommon.py:174\u001b[0m, in \u001b[0;36mensure_root\u001b[0;34m()\u001b[0m\n\u001b[1;32m 172\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mensure_root\u001b[39m():\n\u001b[1;32m 173\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m os\u001b[38;5;241m.\u001b[39mgeteuid() \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m--> 174\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mYou must be root to use this library on linux.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", + "\u001b[0;31mImportError\u001b[0m: You must be root to use this library on linux." + ] + } + ], "source": [ "from rostok.criterion.simulation_flags import EventBodyTooLowBuilder\n", - "scenario = SuspensionCarScenario(0.0001, 3)\n", + "from rostok.control_chrono.controller import SimpleKeyBoardController\n", + "scenario = SuspensionCarScenario(0.0001, 3,initial_vertical_pos=0.5, controller_cls=SimpleKeyBoardController)\n", "scenario.add_event_builder(event_builder=EventBodyTooLowBuilder(0.15))\n", - "control = {\"initial_value\": [0.05]*2}\n", - "\n", - "result = scenario.run_simulation(graph, control, starting_positions=[[45,-90,0], [-90,90,0], [90,-90,0]], vis = True, delay=True)" + "parameters = {}\n", + "parameters[\"forward\"] = 0.5\n", + "parameters[\"reverse\"]= 0.5\n", + "parameters[\"forward_rotate\"] = 0.3\n", + "parameters[\"reverse_rotate\"] = 0.2\n", + "#control = {\"initial_value\": [0.05]*2}\n", + "\n", + "result = scenario.run_simulation(graph, parameters, starting_positions=[[45,-90,0], [-90,90,0], [90,-90,0]], vis = True, delay=True)" ] }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[array([-0.0017, 0.1501, 0. ]),\n", - " array([-0.0017, 0.15 , 0. ]),\n", - " array([-0.0017, 0.15 , 0. ]),\n", - " array([-0.0017, 0.15 , 0. ]),\n", - " array([-0.0017, 0.1499, 0. ])]" + "[array([ 0.0003, 0.1503, -0.0003]),\n", + " array([ 0.0003, 0.1502, -0.0003]),\n", + " array([ 0.0002, 0.1501, -0.0003]),\n", + " array([ 0.0002, 0.15 , -0.0003]),\n", + " array([ 0.0002, 0.1498, -0.0003])]" ] }, - "execution_count": 23, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" }