コード例 #1
0
def random_walk_draw(_robot_base,pen_height,_no_pts,vel,accel):
    way_pts = []
    for i in range(_no_pts):
        y_r = r.randint(50,247)
        x_r = r.randint(50,370)
        r_pt = rg.Point3d(50+5*i,y_r,pen_height)
        way_pts.append(r_pt)

    #way_pts.append(way_pts[-1]+rg.Point3d(0,0,150))
    #way_pts.insert(0,way_pts[0]+rg.Point3d(0,0,150))

    for i,pt in enumerate(way_pts):
        if i>0:
            rs.AddLine(way_pts[i-1],pt)

    way_planes = [rg.Plane(pt,rg.Vector3d.ZAxis) for pt in way_pts]
    way_planes = [rhino_to_robot_space(plane,_robot_base) for plane in way_planes]

    velocity = vel
    acceleration = accel
    robot_ip = ROBOT_IP

    script = ""
    script += ur.set_tcp_by_angles(0.0,0.0,pen_height,m.radians(0.0),m.radians(180.0),m.radians(0))

    for plane in way_planes:
        script += ur. move_l(plane,acceleration,velocity)

    script = c.concatenate_script(script)
    c.send_script(script,robot_ip)
    print script
コード例 #2
0
def move_robot_vertical(move_to):
    script = ""
    script += ur.set_tcp_by_angles(0.0,0.0,0.0,m.radians(0.0),m.radians(180.0),m.radians(0))

    velocity = 0.05
    acceleration = 0.02
    robot_ip = ROBOT_IP

    plane = rg.Plane(move_to,rg.Vector3d.ZAxis)
    script += ur.move_l(plane,acceleration,velocity)

    script = c.concatenate_script(script)
    c.send_script(script,robot_ip)
    print script
コード例 #3
0
ファイル: robotic_drawing.py プロジェクト: tetov/MAS-1920
def nice_walk(_robot_base, pen_height, _no_pts, vel, accel):
    way_pts = []
    step_x = 150 / _no_pts
    step_y = 237 / _no_pts
    for i in range(_no_pts):
        if i % 2 == 0:
            x_r = 30 + step_x * i
            y_r = 30 + step_y * i
            r_pt = rg.Point3d(x_r, y_r, pen_height)
            way_pts.append(r_pt)
        else:
            x_r = 30 + step_x * i
            y_r = 150 + 60 * m.sin(i) * -1
            r_pt = rg.Point3d(x_r, y_r, pen_height)
            way_pts.append(r_pt)

    #way_pts.append(way_pts[-1]+rg.Point3d(0,0,150))
    #way_pts.insert(0,way_pts[0]+rg.Point3d(0,0,150))

    for i, pt in enumerate(way_pts):
        if i > 0:
            rs.AddLine(way_pts[i - 1], pt)

    way_planes = [rg.Plane(pt, rg.Vector3d.ZAxis) for pt in way_pts]
    way_planes = [
        rhino_to_robot_space(plane, _robot_base) for plane in way_planes
    ]

    velocity = vel
    acceleration = accel
    robot_ip = ROBOT_IP

    script = ""
    script += ur.set_tcp_by_angles(0.0, 0.0, pen_height, m.radians(0.0),
                                   m.radians(180.0), m.radians(0))

    for plane in way_planes:
        script += ur.move_l(plane, acceleration, velocity)

    script = c.concatenate_script(script)
    c.send_script(script, robot_ip)
    print script
コード例 #4
0
 def tcp(self):
     self.script += ur.set_tcp_by_angles(0.0, 0.0, 74.0, m.radians(0.0),
                                         m.radians(180.0), m.radians(0))