2021-04-20 23:26:38 +08:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"thanks to -> https://stackoverflow.com/questions/49558464/shrink-polygon-using-corner-coordinates"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 1,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"(-0.8500000000000001, 6.85, -1.3744678440936948, 11.065450849718747)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 1,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA24AAAI/CAYAAAAP9IqBAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAtAklEQVR4nO3de3SdZZ3o8d9O0qbpLU2zC9hKHctFFgzK6ioDolyUwDiIylIGgaXYYXkQqiCgIrAYljeOVae2MFLKzEFgOHPWweWROs54W9EzMANHrQWEwRkQhpmjq0jZTZo0vSRNss8fhZ5CC213373f5935fP4pacOTZ+0n706++e29U6pWq9UAAAAgWS15bwAAAIDXJtwAAAASJ9wAAAASJ9wAAAASJ9wAAAASJ9wAAAASJ9wAAAAS19boD7hu3bpGf8iklcvlqFQqeW+D/eDMiseZFZNzKx5nVjzOrHicWTHtem5z586taQ0TNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwAAgMQJNwA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AByQiTR1M20DIC/CDYADNhGmbqZtAORJuAFwwCbC1M20DYA8CTcAMtHMUzfTNgDyJtwAyEQzT91M2wDIm3ADIDPNOHUzbQMgBcINgMw049TNtA2AFAg3ADLVTFM30zYAUiHcAMh
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 1080x720 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"import numpy as np\n",
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"plt.style.use(\"ggplot\")\n",
|
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"def shrink_polygon(coords, shrink_value_x, shrink_value_y):\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" \"\"\" \"\"\"\n",
|
|
|
|
"\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" def det(a, b):\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" return a[0] * b[1] - a[1] * b[0]\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
" def line_intersection(line1, line2):\n",
|
|
|
|
" xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" ydiff = (line1[0][1] - line1[1][1], line2[0][1] - line2[1][1]) # Typo was here\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
" div = det(xdiff, ydiff)\n",
|
|
|
|
" if div == 0:\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" raise Exception(\"lines do not intersect\")\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
" d = (det(*line1), det(*line2))\n",
|
|
|
|
" x = det(d, xdiff) / div\n",
|
|
|
|
" y = det(d, ydiff) / div\n",
|
|
|
|
" return x, y\n",
|
|
|
|
"\n",
|
|
|
|
" # how much the coordinates are moved as an absolute value\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" # shrink_value_x = 2\n",
|
|
|
|
" # shrink_value_y = 2\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
" # coords must be clockwise\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" # coords = [(0, 0), (0, 100), (20, 100), (30, 60), (40, 100), (60, 100), (60, 0), (40, 10), (40, 40), (20, 40), (20, 10)]\n",
|
|
|
|
"\n",
|
|
|
|
" lines = [[coords[i - 1], coords[i]] for i in range(len(coords))]\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
" new_lines = []\n",
|
|
|
|
" for i in lines:\n",
|
|
|
|
" dx = i[1][0] - i[0][0]\n",
|
|
|
|
" dy = i[1][1] - i[0][1]\n",
|
|
|
|
"\n",
|
|
|
|
" # this is to take into account slopes\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" factor = 1 / (dx * dx + dy * dy) ** 0.5\n",
|
|
|
|
" new_dx = dy * shrink_value_x * factor\n",
|
|
|
|
" new_dy = dx * shrink_value_y * factor\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" new_lines.append(\n",
|
|
|
|
" [(i[0][0] + new_dx, i[0][1] - new_dy), (i[1][0] + new_dx, i[1][1] - new_dy)]\n",
|
|
|
|
" )\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
" # find position of intersection of all the lines\n",
|
|
|
|
" new_coords = []\n",
|
|
|
|
" for i in range(len(new_lines)):\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" new_coords.append((line_intersection(new_lines[i - 1], new_lines[i])))\n",
|
|
|
|
"\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" return new_coords\n",
|
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"\n",
|
|
|
|
"# must be clockwise!\n",
|
|
|
|
"coords = [\n",
|
|
|
|
" (0, 0),\n",
|
|
|
|
" (0, 10),\n",
|
|
|
|
" (2, 10),\n",
|
|
|
|
" (3, 8),\n",
|
|
|
|
" (4, 10),\n",
|
|
|
|
" (6, 10),\n",
|
|
|
|
" (6, 0),\n",
|
|
|
|
" (4, 1),\n",
|
|
|
|
" (4, 4),\n",
|
|
|
|
" (2, 4),\n",
|
|
|
|
" (2, 1),\n",
|
|
|
|
"]\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
"# how much the coordinates are moved as an absolute value\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"SHIFT = 0.5 # [m]\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"up = shrink_polygon(coords, -SHIFT, -SHIFT)\n",
|
|
|
|
"lo = shrink_polygon(coords, SHIFT, SHIFT)\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
"\"\"\"\n",
|
|
|
|
"the last point is out of order for my needs\n",
|
|
|
|
"\"\"\"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"\n",
|
|
|
|
"\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"def rotate(l, n):\n",
|
|
|
|
" return l[n:] + l[:n]\n",
|
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"\n",
|
|
|
|
"up = rotate(up, 1)\n",
|
|
|
|
"lo = rotate(lo, 1)\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
|
|
|
"a = np.array(up)\n",
|
|
|
|
"b = np.array(coords)\n",
|
|
|
|
"c = np.array(lo)\n",
|
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"plt.figure(figsize=(15, 10))\n",
|
|
|
|
"plt.plot(a[:, 0], a[:, 1], \"b-\")\n",
|
|
|
|
"plt.plot(b[:, 0], b[:, 1], \"r-\")\n",
|
|
|
|
"plt.plot(c[:, 0], c[:, 1], \"g-\")\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"plt.axis(\"equal\")"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"now these edges can be used to compute the path as before! Plus outer and inner track"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 2,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"from scipy.interpolate import interp1d\n",
|
|
|
|
"from scipy.signal import savgol_filter\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"def compute_path_from_wp(start_xp, start_yp, step=0.1, smooth_factor=7):\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" \"\"\"\n",
|
|
|
|
" Computes a reference path given a set of waypoints\n",
|
|
|
|
" \"\"\"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"\n",
|
|
|
|
" final_xp = []\n",
|
|
|
|
" final_yp = []\n",
|
|
|
|
" delta = step # [m]\n",
|
|
|
|
"\n",
|
|
|
|
" for idx in range(len(start_xp) - 1):\n",
|
|
|
|
" section_len = np.sum(\n",
|
|
|
|
" np.sqrt(\n",
|
|
|
|
" np.power(np.diff(start_xp[idx : idx + 2]), 2)\n",
|
|
|
|
" + np.power(np.diff(start_yp[idx : idx + 2]), 2)\n",
|
|
|
|
" )\n",
|
|
|
|
" )\n",
|
|
|
|
"\n",
|
|
|
|
" interp_range = np.linspace(0, 1, np.floor(section_len / delta).astype(int))\n",
|
|
|
|
"\n",
|
|
|
|
" fx = interp1d(np.linspace(0, 1, 2), start_xp[idx : idx + 2], kind=1)\n",
|
|
|
|
" fy = interp1d(np.linspace(0, 1, 2), start_yp[idx : idx + 2], kind=1)\n",
|
|
|
|
"\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" # watch out to duplicate points!\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" final_xp = np.append(final_xp, fx(interp_range)[1:])\n",
|
|
|
|
" final_yp = np.append(final_yp, fy(interp_range)[1:])\n",
|
|
|
|
"\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" \"\"\"this smoothens up corners\"\"\"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" window_size = smooth_factor # Smoothening filter window\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" final_xp = savgol_filter(final_xp, window_size, 1)\n",
|
|
|
|
" final_yp = savgol_filter(final_yp, window_size, 1)\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" dx = np.append(0, np.diff(final_xp))\n",
|
|
|
|
" dy = np.append(0, np.diff(final_yp))\n",
|
|
|
|
" theta = np.arctan2(dy, dx)\n",
|
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" return np.vstack((final_xp, final_yp, theta))"
|
2021-04-20 23:26:38 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 3,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"Text(0.5, 0, 'x')"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 3,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA3gAAAJQCAYAAADc5sahAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAABP8UlE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SwIGWvHZn+P79byWMHavAHXeopbjY8tc3Ojacvz8Kj0Xb97dV564kJaSlqaW4WMFbbrHsNfcXf8e5E8fNnRITEzv8mSWbrBjJzMxURUWFsrOzVVFRoYyMjA4fW1hYqMLCwtavy8rKrCjR0fLy8hgHF+K4mSeroUGJwaAp49v+uJWUpKu4uPqHr/KVlPTjJBv+cFxUVK3S0nRt3rxlt+cqKMjf7Xvtv+7s95z4e+GvS0rSddtt6a1jER6foqJqSYmtY7n7OEZf+LjFXXCBej70kAI336ydpaWmvV5X5dx0k+JycrT9179WyKJ5of25e+21jbt1qbp6/hp9LxrnWPjY2XFOh//b25+/kiw7dyWpt6S6ujpVu+jvDP6OcyeOmzvl5+d3+DPbLtEcMWKE3nnnHUnSO++8o5EjR9pVCgB0SWlpugoK8lVQsOfkunnzFm3evMX0D39OVlxc3ToOUjjY/Xi5W3jsrLokMHxfPCetxbNr7V37czd8DMLHiPN3z/O3LavPXQDYF5YEvHvvvVfXX3+9tmzZoksuuUSLFy/WWWedpVWrVumKK67QqlWrdNZZZ1lRCgDss7ZrcNp+AOzow2D4Q3Ok73XmMW75PaPHSHt+YDY
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 1080x720 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2022-08-02 16:33:49 +08:00
|
|
|
"track = compute_path_from_wp(b[:, 0], b[:, 1])\n",
|
|
|
|
"track_lower = compute_path_from_wp(c[:, 0], c[:, 1])\n",
|
|
|
|
"track_upper = compute_path_from_wp(a[:, 0], a[:, 1])\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"plt.figure(figsize=(15, 10))\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"plt.plot(track[0, :], track[1, :], \"b+\")\n",
|
|
|
|
"plt.plot(track_lower[0, :], track_lower[1, :], \"g-\")\n",
|
|
|
|
"plt.plot(track_upper[0, :], track_upper[1, :], \"r-\")\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
"plt.axis(\"equal\")\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"plt.ylabel(\"y\")\n",
|
|
|
|
"plt.xlabel(\"x\")"
|
2021-04-20 23:26:38 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 4,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"[<matplotlib.lines.Line2D at 0x7fc509665310>]"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 4,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD4CAYAAAAEhuazAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAABNp0lEQVR4nO29e3xj9Xnn/z7nSLYsy1dJtsdjj2V7PMAEysDOkDAlQIpDuk1/+bGzLAt9pWmmUJqFJIVZ0mVDk2yXXKY/GG4plJYmbS776kK2gTZNabaGdGgZEqZcSgKBGc/Ynps9tiTfLVnSOef3x5Fk2Zaso8uRLev7/mfGR+d8v4+OpI8ePd/neb6Srus6AoFAIKgo5PU2QCAQCASlR4i/QCAQVCBC/AUCgaACEeIvEAgEFYgQf4FAIKhAhPgLBAJBBWJbbwNy4dy5c3ld5/F48Pv9RbamcIRduSHsyg1hV25sVrva29vTHheev0AgEFQgQvwFAoGgAhHiLxAIBBWIEH+BQCCoQIT4CwQCQQUixF8gE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W0r1NPQwHZlmcnEy/UU5jZ/e85clmWZH5qy97m5j0TfjoJC35x8IyKtCPmBk/AAow8MZp8wHxe9HdziW9u4V4i8QCNabTJ4/wInpE4WPn0H83Q73mhu3+3wxhodt6fUxneefU9hHSSv+en09qtuNbWh5yKsYnr/q8SzdiGJ0ilsHhPgLBJuItcS/WIu+6cQ/2/aNPp/K3JxMMJhGctKIfy5NPQ3PP30ff7WrC9sKz78Y4q+lVtwm9vAVnr9AIFgv0i34dtZ1YpNsRRH/TJ5/tk1curqMLJ+hoTS/Doq
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 432x288 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2022-08-02 16:33:49 +08:00
|
|
|
"plt.plot(np.degrees(track[2, :]), \"b-\")\n",
|
|
|
|
"plt.plot(np.degrees(track_lower[2, :]), \"g-\")\n",
|
|
|
|
"plt.plot(np.degrees(track_upper[2, :]), \"r-\")"
|
2021-04-20 23:26:38 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"probably smarter to to save this in a file and load it in a notebook, so I dont have to carry over the code..."
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 5,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2022-08-02 16:33:49 +08:00
|
|
|
"with open(\"tracks/test.npy\", \"wb\") as f:\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" np.save(f, track)\n",
|
|
|
|
" np.save(f, track_lower)\n",
|
|
|
|
" np.save(f, track_upper)\n",
|
|
|
|
"\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
"with open(\"tracks/test.npy\", \"rb\") as f:\n",
|
2021-04-20 23:26:38 +08:00
|
|
|
" a = np.load(f)\n",
|
|
|
|
" b = np.load(f)\n",
|
2022-08-02 16:33:49 +08:00
|
|
|
" c = np.load(f)"
|
2021-04-20 23:26:38 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 6,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2022-08-02 16:33:49 +08:00
|
|
|
"# matches perfectly!\n",
|
|
|
|
"# plt.plot(np.degrees(a[2,:]),\"b-\")\n",
|
|
|
|
"# plt.plot(np.degrees(b[2,:]),\"g-\")\n",
|
|
|
|
"# plt.plot(np.degrees(c[2,:]),\"r-\")"
|
2021-04-20 23:26:38 +08:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": "Python [conda env:.conda-jupyter] *",
|
|
|
|
"language": "python",
|
|
|
|
"name": "conda-env-.conda-jupyter-py"
|
|
|
|
},
|
|
|
|
"language_info": {
|
|
|
|
"codemirror_mode": {
|
|
|
|
"name": "ipython",
|
|
|
|
"version": 3
|
|
|
|
},
|
|
|
|
"file_extension": ".py",
|
|
|
|
"mimetype": "text/x-python",
|
|
|
|
"name": "python",
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
"pygments_lexer": "ipython3",
|
|
|
|
"version": "3.8.5"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 4
|
|
|
|
}
|