def pickup_brick(self, pick_up_plane): """Example of a method's documentation. Parameters ---------- point_x : float Description of the first param point_y : float Description of the second param """ safe_distance = 50 safe_plane = pick_up_plane.Clone() safe_plane.Translate(rg.Vector3d(0, 0, safe_distance)) self.script += ur.move_l(safe_plane, self.accel, self.vel) self.way_planes.append(safe_plane) self.script += ur.move_l(pick_up_plane, self.accel, self.vel) self.way_planes.append(pick_up_plane) self.script += ur.set_digital_out(4, True) self.script += ur.sleep(1) self.script += ur.move_l(safe_plane, self.accel, self.vel) self.way_planes.append(safe_plane) return None
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
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
def place_brick(self, plane): """ this function gereates the robotic sequience for placing a brick Requires a plane wich describes the possition of the brick""" safe_distance = 50 safe_plane = plane.Clone() safe_plane.Translate(rg.Vector3d(0, 0, safe_distance)) self.script += ur.move_l(safe_plane, self.accel, self.vel) self.way_planes.append(safe_plane) self.script += ur.move_l(plane, self.accel, self.vel) self.way_planes.append(plane) self.script += ur.set_digital_out(4, False) self.script += ur.sleep(1) self.script += ur.move_l(safe_plane, self.accel, self.vel) self.way_planes.append(safe_plane) return None
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
#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