From cdac437c14ed82f4ccb20d15d46f7479d579a930 Mon Sep 17 00:00:00 2001 From: Jerec Date: Tue, 8 Oct 2019 10:47:33 -0400 Subject: [PATCH] created map waypoint generator. --- log-analysis/Training_analysis.ipynb | 47 ++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/log-analysis/Training_analysis.ipynb b/log-analysis/Training_analysis.ipynb index f255ca768..3d768543b 100644 --- a/log-analysis/Training_analysis.ipynb +++ b/log-analysis/Training_analysis.ipynb @@ -196,6 +196,47 @@ "road_poly" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Create Boarders\n", + "one_poly = plt.Polygon(l_inner_border, closed=True, fill=None, edgecolor=\"black\")\n", + "two_poly = plt.Polygon(l_outer_border, closed=True, fill=None, edgecolor=\"black\")\n", + "fig, ax = plt.subplots()\n", + "ax.add_patch(one_poly)\n", + "ax.add_patch(two_poly)\n", + "\n", + "# Get number of waypoints\n", + "number_of_waypoints = str(l_center_line.shape[0])\n", + "\n", + "# Plot waypoints\n", + "\n", + "for i, point in enumerate(l_center_line):\n", + " waypoint = (point[0], point[1])\n", + " #check if it the 10th waypoint\n", + " if i % 10 == 0 or i == int(number_of_waypoints) - 1:\n", + " #check if it is the first or last waypoint. they are the same\n", + " if i == 0 or i == int(number_of_waypoints) - 1:\n", + " plt.scatter(point[0], point[1], color='Green', marker=\"*\")\n", + " if i == 0:\n", + " plt.annotate(i,(point[0], point[1]), textcoords=\"offset points\", xytext=(0,3),\n", + " ha=\"right\")\n", + " else:\n", + " plt.scatter(point[0], point[1], color='red', marker=\".\")\n", + " plt.annotate(i,(point[0], point[1]), textcoords=\"offset points\", xytext=(3,5),\n", + " ha=\"center\")\n", + " else:\n", + " plt.scatter(point[0], point[1], color='blue', marker=\".\")\n", + " #print(\"Waypoint \" + str(i) + \": \" + str(waypoint))\n", + "\n", + "# Saves image to running directory\n", + "plt.savefig('waypoints.png', dpi=250)\n", + "plt.show()" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -2594,14 +2635,14 @@ "language_info": { "codemirror_mode": { "name": "ipython", - "version": 3 + "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.8" + "pygments_lexer": "ipython2", + "version": "2.7.15+" } }, "nbformat": 4,