本文整理匯總了Python中visualizer.Visualizer.define_obstacles方法的典型用法代碼示例。如果您正苦於以下問題:Python Visualizer.define_obstacles方法的具體用法?Python Visualizer.define_obstacles怎麽用?Python Visualizer.define_obstacles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類visualizer.Visualizer
的用法示例。
在下文中一共展示了Visualizer.define_obstacles方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Visualizer
# 需要導入模塊: from visualizer import Visualizer [as 別名]
# 或者: from visualizer.Visualizer import define_obstacles [as 別名]
import pickle
import time
from pathplan import PathPlanner
from visualizer import Visualizer
from collisiondetect import CollisionDetector
sys.setrecursionlimit(5000)
# Initial Config
q_init = (100.0, 500.0, 0.0)
q_goal = (700.0, 500.0, -2.15)
# Define and convert obstacles
vizer = Visualizer()
vizer.draw_square(q_init)
vizer.draw_square(q_goal, color=vizer.RED)
obstcls = vizer.define_obstacles()
cd = CollisionDetector(obstcls)
obstcls_aabb = cd.compute_AABB()
# Plan path using q_init and obstacles
planner = PathPlanner(q_init, cd)
start = time.time()
# Call algorithm
rrt_tree = planner.build_rrtstar(K=2000, epsilon=5)
end = time.time()
print('Time taken: %f' % (end - start))
# Holonomic
q_nearest, dist, _ = planner.nearest_neighbour(q_goal, np.array(rrt_tree.vertexMap.keys()))