本文整理汇总了Python中Robot.Robot.draw方法的典型用法代码示例。如果您正苦于以下问题:Python Robot.draw方法的具体用法?Python Robot.draw怎么用?Python Robot.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Robot.Robot
的用法示例。
在下文中一共展示了Robot.draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Planner
# 需要导入模块: from Robot import Robot [as 别名]
# 或者: from Robot.Robot import draw [as 别名]
#.........这里部分代码省略.........
elif line.startswith('endrobot'):
points = self.processPolygon(robotLines, start, i)
self.robot = Robot(points)
def computeCObstacles(self):
for obs in self.obstacles:
obs.computeCSpaceObstcale(self.robot)
#self.cSpaceObs.append(obs.merged)
return
change = True
while change:
change = False
o1 = None
o2 = None
m = None
for obs in self.cSpaceObs:
for obs2 in self.cSpaceObs:
if obs == obs2:
continue
m = obs.merge(obs2)
if len(m) == 1:
change = True
o1 = obs
o2 = obs2
if change:
self.cSpaceObs.remove(o1)
self.cSpaceObs.remove(o2)
self.cSpaceObs.extend(m)
def processPolygon(self, lines, startLine, endLine):
print 'process polygon'
points = []
previousPoint = None
for x in range(startLine + 1, endLine):
line = lines[x]
if line.startswith("#"):
continue
tokens = line.split()
if len(tokens) == 2:
point = self.list2point(tokens)
points.append(point)
else:
print 'Error invalid vertex length: ' + line
return points
# obstacle = Obstacle(points)
# self.obstacles.append(obstacle)
def list2point(self, pointList):
coords = [float(x) for x in pointList]
return Point(*coords);
def getRoadmap(self):
# First compute the c-space obstacles
self.computeCObstacles()
def drawCSpace(self):
for obs in self.cSpaceObs:
for line in obs:
line.draw()
def draw(self):
glPushMatrix()
for obstacle in self.obstacles:
obstacle.draw()
self.robot.draw()
self.drawCSpace()
glPopMatrix()