同步操作将从 Gitee 极速下载/PythonRobotics 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
"""Matplotlib based plotting utilities"""import mathimport matplotlib.pyplot as pltimport numpy as npdef plot_arrow(x, y, yaw, arrow_length=1.0,origin_point_plot_style="xr",head_width=0.1, fc="r", ec="k", **kwargs):"""Plot an arrow or arrows based on 2D state (x, y, yaw)All optional settings of matplotlib.pyplot.arrow can be used.- matplotlib.pyplot.arrow:https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.arrow.htmlParameters----------x : a float or array_likea value or a list of arrow origin x position.y : a float or array_likea value or a list of arrow origin y position.yaw : a float or array_likea value or a list of arrow yaw angle (orientation).arrow_length : a float (optional)arrow length. default is 1.0origin_point_plot_style : str (optional)origin point plot style. If None, not plotting.head_width : a float (optional)arrow head width. default is 0.1fc : string (optional)face colorec : string (optional)edge color"""if not isinstance(x, float):for (i_x, i_y, i_yaw) in zip(x, y, yaw):plot_arrow(i_x, i_y, i_yaw, head_width=head_width,fc=fc, ec=ec, **kwargs)else:plt.arrow(x, y,arrow_length * math.cos(yaw),arrow_length * math.sin(yaw),head_width=head_width,fc=fc, ec=ec,**kwargs)if origin_point_plot_style is not None:plt.plot(x, y, origin_point_plot_style)def plot_curvature(x_list, y_list, heading_list, curvature,k=0.01, c="-c", label="Curvature"):"""Plot curvature on 2D path. This plot is a line from the original path,the lateral distance from the original path shows curvature magnitude.Left turning shows right side plot, right turning shows left side plot.For straight path, the curvature plot will be on the path, becausecurvature is 0 on the straight path.Parameters----------x_list : array_likex position list of the pathy_list : array_likey position list of the pathheading_list : array_likeheading list of the pathcurvature : array_likecurvature list of the pathk : floatcurvature scale factor to calculate distance from the original pathc : stringcolor of the plotlabel : stringlabel of the plot"""cx = [x + d * k * np.cos(yaw - np.pi / 2.0) for x, y, yaw, d inzip(x_list, y_list, heading_list, curvature)]cy = [y + d * k * np.sin(yaw - np.pi / 2.0) for x, y, yaw, d inzip(x_list, y_list, heading_list, curvature)]plt.plot(cx, cy, c, label=label)for ix, iy, icx, icy in zip(x_list, y_list, cx, cy):plt.plot([ix, icx], [iy, icy], c)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。