Beispiel #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
Beispiel #2
0
    def send(self):
        """
        this funktion sends the script to the robot."""

        self.script = c.concatenate_script(self.script)
        #c.send_script(self.script, self.robot_ip)
        return self.script
Beispiel #3
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
Beispiel #4
0
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
Beispiel #5
0
#rd.set_robot_base_plane()

robot_base = rd.load_robot_base_plane()

zero_plane = rg.Plane(rg.Point3d(0,0,0),rg.Vector3d.ZAxis)

plane_1 = rg.Plane(rg.Point3d(297.0,0,100),rg.Vector3d.ZAxis)
plane_2 = rg.Plane(rg.Point3d(297,297,0),rg.Vector3d.ZAxis)
plane_3 = rg.Plane(rg.Point3d(0,297,0),rg.Vector3d.ZAxis)

way_planes = [zero_plane,plane_1,plane_2,plane_3]
robo_planes = []

for way_plane in way_planes:
    robo_plane = rd.rhino_to_robot_space(way_plane,robot_base)
    robo_planes.append(robo_plane)

robo_planes *= 10

accel = 0.1
vel = 0.2

script = ''
for robo_plane in robo_planes:
    script += ur.move_l(robo_plane, accel, vel)

if execute:
    script = c.concatenate_script(script)
    c.send_script(script, rd.ROBOT_IP)
else:
    print script