當前位置: 首頁>>代碼示例>>Python>>正文


Python Visualizer.plot_points方法代碼示例

本文整理匯總了Python中visualizer.Visualizer.plot_points方法的典型用法代碼示例。如果您正苦於以下問題:Python Visualizer.plot_points方法的具體用法?Python Visualizer.plot_points怎麽用?Python Visualizer.plot_points使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在visualizer.Visualizer的用法示例。


在下文中一共展示了Visualizer.plot_points方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: CollisionDetector

# 需要導入模塊: from visualizer import Visualizer [as 別名]
# 或者: from visualizer.Visualizer import plot_points [as 別名]
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()
rrt_tree = planner.nh_build_rrt(K=100, epsilon=40)
end = time.time()
print('Time taken: %f' % (end - start))

q_nearest, dist, _ = planner.nearest_neighbour(q_goal, np.array(rrt_tree.vertexMap.keys()))

# Non Holonomic
vizer.nh_plot_graph(rrt_tree, q_init)
vizer.nh_trace_path(rrt_tree.getVertex(q_nearest))
a,b,c,d = planner.nh_reach_goal(q_nearest, q_goal)
final_list = planner.append_t1_m_t2(a, b, c)
vizer.plot_points(final_list, vizer.YELLOW, 3)
if not planner.nh_obstacle_free(final_list):
    print 'Final Maneuve collide with obstacle'

vizer.draw_square(q_init)
vizer.draw_square(q_goal, color=vizer.RED)
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
開發者ID:iamprem,項目名稱:rmp,代碼行數:32,代碼來源:demo2.py

示例2: open

# 需要導入模塊: from visualizer import Visualizer [as 別名]
# 或者: from visualizer.Visualizer import plot_points [as 別名]
# Write Tree to File
# outfile = open('rrtstar_nonholo.pkl', 'wb')
# pickle.dump(rrt_tree, outfile, pickle.HIGHEST_PROTOCOL)
# outfile.close()

# rrt_tree = pickle.load(open('rrt_nonholo.pkl', 'rb'))


# Holonomic
q_nearest, dist, _ = planner.nearest_neighbour(q_goal, np.array(rrt_tree.vertexMap.keys()))
q_goal_vtx = planner.reach_goal(rrt_tree, q_goal)
vizer.plot_graph(rrt_tree, q_init)
vizer.trace_path(q_goal_vtx)

# Non Holonomic
"""
# vizer.nh_plot_graph(rrt_tree, q_init)
# vizer.nh_trace_path(rrt_tree.getVertex(q_nearest))

a,b,c,d = planner.nh_reach_goal(q_nearest, q_goal)
final_list = planner.append_t1_m_t2(a, b, c)
# TODO final_list collision check
vizer.plot_points(final_list, vizer.YELLOW, 3)
# vizer.plot_points(a[0], vizer.YELLOW, 2)
# vizer.plot_points(a[1], vizer.YELLOW, 2)
# vizer.plot_points(a[2], vizer.YELLOW, 2)
# vizer.plot_points(b, vizer.BROWN, 2)
# for t in c:
#     vizer.plot_points(t[0], vizer.CYAN, 2)
#     vizer.plot_points(t[1], vizer.CYAN, 2)
#     vizer.plot_points(t[2], vizer.CYAN, 2)
開發者ID:iamprem,項目名稱:rmp,代碼行數:33,代碼來源:playground.py

示例3: CollisionDetector

# 需要導入模塊: from visualizer import Visualizer [as 別名]
# 或者: from visualizer.Visualizer import plot_points [as 別名]
import sys
from collisiondetect import CollisionDetector
from pathplan import PathPlanner
from visualizer import Visualizer

q_init = (400.0, 400.0, 0.0)
obstcls = pickle.load(open('scene_01.pkl', 'rb'))
cd = CollisionDetector(obstcls)
vizer = Visualizer()
obstcls_aabb = cd.compute_AABB()

# Plan path using q_init and obstacles
planner = PathPlanner(q_init, cd)

a,b,c = planner.nh_reach_goal(q_init, (200.0, 200.0, 3.14))
vizer.plot_points(a[0])
vizer.plot_points(a[1])
vizer.plot_points(a[2])
vizer.plot_points(b)
for t in c:
    vizer.plot_points(t[0])
    vizer.plot_points(t[1])
    vizer.plot_points(t[2])

print "done"

a,b,c = planner.t2_maneuver((200.0, 200.0, 0.0), 3.14)
vizer.plot_points(a)
vizer.plot_points(b)
vizer.plot_points(c)
a,b,c = planner.t1_maneuver(q_init, 20)
開發者ID:iamprem,項目名稱:rmp,代碼行數:33,代碼來源:desert.py


注:本文中的visualizer.Visualizer.plot_points方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。