Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 4983a653 authored by Edmond Irani Liu's avatar Edmond Irani Liu 🏂
Browse files

update tutorial, add plot grid

parent 10b67a2c
......@@ -9,6 +9,7 @@ __status__ = "Beta"
import enum
from typing import List, Dict, Tuple, Type
import numpy as np
import ipywidgets as widgets
import matplotlib.pyplot as plt
from IPython import display
......@@ -191,7 +192,9 @@ def display_steps(scenario_data, config, algorithm, **args):
def plot_primitives(list_primitives, figsize=(12, 3)):
plt.figure(figsize=figsize)
fig = plt.figure(figsize=figsize)
ax = fig.gca()
for primitive in list_primitives:
list_x = [state.position[0] for state in primitive.trajectory.state_list]
list_y = [state.position[1] for state in primitive.trajectory.state_list]
......@@ -201,7 +204,11 @@ def plot_primitives(list_primitives, figsize=(12, 3)):
plt.plot(list_x, list_y)
ax.set_xticks(np.arange(-5, 20, 0.5))
ax.set_yticks(np.arange(-5, 5., 0.5))
plt.axis('equal')
plt.grid(alpha=0.5)
plt.show()
......@@ -251,7 +258,14 @@ def visualize_solution(scenario: Scenario, planning_problem_set: PlanningProblem
draw_object(planning_problem_set)
draw_object(dynamic_obstacle,
draw_params={'time_begin': i,
'dynamic_obstacle': {'shape': {'facecolor': 'green'}}})
'dynamic_obstacle': {'shape': {'facecolor': 'green'},
'trajectory': {'draw_trajectory': True,
'facecolor': '#ff00ff',
'draw_continuous': True,
'z_order': 60,
'line_width': 5}
}
})
plt.gca().set_aspect('equal')
plt.show()
......@@ -57,6 +57,7 @@
"%autoreload 2\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from MotionPrimitiveGenerator import MotionPrimitiveGenerator as MPG"
]
},
......@@ -112,14 +113,18 @@
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 3))\n",
"fig = plt.figure(figsize=(12, 3))\n",
"ax = fig.gca()\n",
"\n",
"for traj in list_motion_primitives:\n",
" list_x = [state.position[0] for state in traj.state_list]\n",
" list_y = [state.position[1] for state in traj.state_list]\n",
" plt.plot(list_x, list_y)\n",
"\n",
"ax.set_xticks(np.arange(-5, 20, 0.5))\n",
"ax.set_yticks(np.arange(-5, 5., 0.5))\n",
"plt.axis('equal')\n",
"plt.grid(alpha=0.5)\n",
"plt.xlim((-1,11))\n",
"plt.ylim((-1,2))\n",
"plt.show()"
......@@ -156,14 +161,18 @@
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 5))\n",
"fig = plt.figure(figsize=(12, 5))\n",
"ax = fig.gca()\n",
"\n",
"for traj in list_motion_primitives_mirrored:\n",
" list_x = [state.position[0] for state in traj.state_list]\n",
" list_y = [state.position[1] for state in traj.state_list]\n",
" plt.plot(list_x, list_y)\n",
"\n",
"ax.set_xticks(np.arange(-5, 20, 0.5))\n",
"ax.set_yticks(np.arange(-5, 5., 0.5))\n",
"plt.axis('equal')\n",
"plt.grid(alpha=0.5)\n",
"plt.xlim((-1,11))\n",
"plt.ylim((-2,2))\n",
"plt.show()"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment