Пример #1
0
def buildRobot():

    d = DebugData()
    d.addCone((0, 0, 0), (1, 0, 0), height=0.2, radius=0.1)
    obj = vis.showPolyData(d.getPolyData(), 'robot')
    frame = vis.addChildFrame(obj)
    return obj
Пример #2
0
def buildRobot(x=0,y=0):

    d = DebugData()
    d.addCone((x,y,0), (1,0,0), height=0.2, radius=0.1)
    obj = vis.showPolyData(d.getPolyData(), 'robot')
    frame = vis.addChildFrame(obj)
    return obj
Пример #3
0
 def createPolyLine(params):
     d = DebugData()
     points = [np.asarray(p) for p in params["points"]]
     color = params.get("color", DEFAULT_COLOR)[:3]
     radius = params.get("radius", 0.01)
     startHead = params.get("start_head", False)
     endHead = params.get("end_head", False)
     headRadius = params.get("head_radius", 0.05)
     headLength = params.get("head_length", headRadius)
     isClosed = params.get("closed", False)
     if startHead:
         normal = points[0] - points[1]
         normal = normal / np.linalg.norm(normal)
         points[0] = points[0] - 0.5 * headLength * normal
         d.addCone(origin=points[0],
                   normal=normal,
                   radius=headRadius,
                   height=headLength,
                   color=color,
                   fill=True)
     if endHead:
         normal = points[-1] - points[-2]
         normal = normal / np.linalg.norm(normal)
         points[-1] = points[-1] - 0.5 * headLength * normal
         d.addCone(origin=points[-1],
                   normal=normal,
                   radius=headRadius,
                   height=headLength,
                   color=color,
                   fill=True)
     d.addPolyLine(points, isClosed, radius=radius, color=color)
     return [d.getPolyData()]
Пример #4
0
 def createPolyLine(params):
     d = DebugData()
     points = [np.asarray(p) for p in params["points"]]
     color = params.get("color", DEFAULT_COLOR)[:3]
     radius = params.get("radius", 0.01)
     startHead = params.get("start_head", False)
     endHead = params.get("end_head", False)
     headRadius = params.get("head_radius", 0.05)
     headLength = params.get("head_length", headRadius)
     isClosed = params.get("closed", False)
     if startHead:
         normal = points[0] - points[1]
         normal = normal / np.linalg.norm(normal)
         points[0] = points[0] - 0.5 * headLength * normal
         d.addCone(origin=points[0], normal=normal, radius=headRadius,
                   height=headLength, color=color, fill=True)
     if endHead:
         normal = points[-1] - points[-2]
         normal = normal / np.linalg.norm(normal)
         points[-1] = points[-1] - 0.5 * headLength * normal
         d.addCone(origin=points[-1], normal=normal, radius=headRadius,
                   height=headLength, color=color, fill=True)
     d.addPolyLine(points, isClosed, radius=radius, color=color)
     return [d.getPolyData()]
Пример #5
0
d.addArrow((0, 0, 0), (0, 1, 0))
show(d, (2, 2, 0))


d = DebugData()
d.addEllipsoid((0, 0, 0), radii=(0.5, 0.35, 0.2))
show(d, (4, 2, 0))


d = DebugData()
d.addTorus(radius=0.5, thickness=0.2)
show(d, (6, 2, 0))


d = DebugData()
d.addCone(origin=(0,0,0), normal=(0,1,0), radius=0.3, height=0.8, color=[1, 1, 0])
show(d, (0, 4, 0))


d = DebugData()
d.addCube(dimensions=[0.8, 0.5, 0.3], center=[0, 0, 0], color=[0, 1, 1])
show(d, (2, 4, 0))


d = DebugData()
d.addPlane(origin=[0, 0, 0], normal=[0, 0, 1], width=0.8, height=0.7, resolution=10, color=[0, 1, 0])
show(d, (4, 4, 0)).setProperty('Surface Mode', 'Surface with edges')

d = DebugData()
d.addCapsule(center=[0, 0, 0], axis=[1, 0, 0], length=1.0, radius=0.1, color=[0.5, 0.5, 1])
show(d, (6, 4, 0))
Пример #6
0
def makeRobotPolyData():
    d = DebugData()
    d.addCone(origin=(0,0,0), normal=(1,0,0), radius=0.2, height=0.3)
    return d.getPolyData()