|
@@ -14,7 +14,6 @@ class MapGLWidget(PyGLWidget):
|
|
|
|
|
|
robot1_ = None
|
|
|
robot2_ = None
|
|
|
- robotMain_ = None
|
|
|
def __init__(self):
|
|
|
PyGLWidget.__init__(self)
|
|
|
GLUT.glutInit()
|
|
@@ -23,9 +22,6 @@ class MapGLWidget(PyGLWidget):
|
|
|
def SetRobot2Instance(self, robot):
|
|
|
self.robot2_ = robot
|
|
|
|
|
|
- def SetRobotMainInstance(self, robot):
|
|
|
- self.robotMain_ = robot
|
|
|
-
|
|
|
def AddNode(self, node):
|
|
|
[id, type, point] = node
|
|
|
self.nodes[id] = [type, point]
|
|
@@ -122,11 +118,16 @@ class MapGLWidget(PyGLWidget):
|
|
|
glVertex2d(y_source[0], y_source[1])
|
|
|
glEnd()
|
|
|
|
|
|
- def DrawMainAGV(self,pose,rgb,label):
|
|
|
- [x,y,yaw]=pose
|
|
|
- l=0.8 #轮长
|
|
|
+ def DrawMainAGV(self,pose,rgb,label,running=False):
|
|
|
+ l=0.8 #轮长
|
|
|
L=1.3 #轴距
|
|
|
- W=2.5 #宽
|
|
|
+ W=2.5
|
|
|
+ if running:
|
|
|
+ l=1.6 #轮长
|
|
|
+ L=3 #轴距
|
|
|
+ W=2.5
|
|
|
+ [x,y,yaw]=pose
|
|
|
+ #宽
|
|
|
pt1=self.Transform([-(L+l)/2,W/2],yaw,[x,y])
|
|
|
pt2=self.Transform([-(L-l)/2,W/2],yaw,[x,y])
|
|
|
pt3=self.Transform([(L-l)/2,W/2],yaw,[x,y])
|
|
@@ -152,7 +153,7 @@ class MapGLWidget(PyGLWidget):
|
|
|
glVertex2d(pt8[0],pt8[1])
|
|
|
glEnd()
|
|
|
|
|
|
- glLineWidth(3)
|
|
|
+ glLineWidth(2)
|
|
|
glBegin(GL_LINES)
|
|
|
glVertex2d(pt2[0],pt2[1])
|
|
|
glVertex2d(pt6[0],pt6[1])
|
|
@@ -166,8 +167,7 @@ class MapGLWidget(PyGLWidget):
|
|
|
glEnd()
|
|
|
#绘制方向
|
|
|
self.drawAxis(pose,1.2,5)
|
|
|
- color=[0,0,0]
|
|
|
- self.DrawText([x-W/2,y-l/2],label,5,1.5,color)
|
|
|
+ self.DrawText([x-W/2,y-l/2],label,5,1.5,rgb)
|
|
|
def DrawAGV(self,pose,rgb,label=""):
|
|
|
[x,y,yaw]=pose
|
|
|
l=0.8 #轮长
|
|
@@ -186,7 +186,7 @@ class MapGLWidget(PyGLWidget):
|
|
|
glDepthMask(GL_FALSE)
|
|
|
glColor3f(rgb[0],rgb[1],rgb[2])
|
|
|
|
|
|
- glLineWidth(5)
|
|
|
+ glLineWidth(3)
|
|
|
glBegin(GL_LINES)
|
|
|
glVertex2d(pt1[0],pt1[1])
|
|
|
glVertex2d(pt2[0],pt2[1])
|
|
@@ -225,9 +225,7 @@ class MapGLWidget(PyGLWidget):
|
|
|
glEnd()
|
|
|
l=len(label)
|
|
|
self.DrawText([x-l/8,y],label,size/10,1,[1,1,1])
|
|
|
- '''glColor3f(1,1,1);
|
|
|
- #glBegin(GL_TEXTURE)
|
|
|
- glText'''
|
|
|
+
|
|
|
def DrawRobotData(self,robot):
|
|
|
if robot is not None:
|
|
|
if robot.currentNavPath_ is not None:
|
|
@@ -242,7 +240,10 @@ class MapGLWidget(PyGLWidget):
|
|
|
y = agv_statu.y
|
|
|
theta = agv_statu.theta
|
|
|
if robot.IsMainAgv():
|
|
|
- self.DrawMainAGV([x, y, theta], robot.Color(),robot.name_)
|
|
|
+ if robot.IsMainModeStatu():
|
|
|
+ self.DrawMainAGV([x, y, theta], robot.Color(),robot.name_,True)
|
|
|
+ else:
|
|
|
+ self.DrawMainAGV([x, y, theta], robot.Color(),robot.name_)
|
|
|
else:
|
|
|
self.DrawAGV([x, y, theta], robot.Color(),robot.name_)
|
|
|
|
|
@@ -255,9 +256,8 @@ class MapGLWidget(PyGLWidget):
|
|
|
def paintGL(self):
|
|
|
PyGLWidget.paintGL(self)
|
|
|
self.drawAxis([0, 0, 0], 3, 2)
|
|
|
-
|
|
|
#绘制地图
|
|
|
- '''for road in self.roads.items():
|
|
|
+ for road in self.roads.items():
|
|
|
[_, value] = road
|
|
|
for nodeId in value:
|
|
|
for nextId in value:
|
|
@@ -270,7 +270,7 @@ class MapGLWidget(PyGLWidget):
|
|
|
if type == "street_node":
|
|
|
self.drawNode(point, 30, [0, 0.5, 0.5],name)
|
|
|
if type == "space_node":
|
|
|
- self.drawNode(point, 20, [0.3, 0.8, 0.7],name)'''
|
|
|
+ self.drawNode(point, 20, [0.3, 0.8, 0.7],name)
|
|
|
|
|
|
#绘制agv相关数据,路径、轨迹、位姿
|
|
|
self.DrawRobotData(self.robot1_)
|