def __init__(self, run_on_real=False, offset=30, acceleration=1000, speed=500): self.offset = offset self.robodk = robolink.Robolink() # Link with simulator self.robot = self.robodk.Item('KUKA KR 16 2') self.draw_frame = self.robodk.Item('Frame draw') self.draw_tool = self.robodk.Item('Tool') self.robot.setAcceleration(acceleration) self.robot.setSpeed(speed) if run_on_real: self.connect_to_real_robot()
def runmain(): RDK = rlk.Robolink() # Get the programs to merge programs = list(filter(lambda item: item.Type() == rlk.ITEM_TYPE_PROGRAM, RDK.Selection())) if len(programs) < 2: RDK.ShowMessage('Please select at least two programs.') return # Create a new empty program merged_prog = getMergedProg(programs, RDK) # Merge programs into the new program mergeProgs(programs, merged_prog)
def main(): # Read transformation matrices and joint angles from CSV file frame_filename = "reference_frames.csv" joint_filename = "joint_angles.csv" frames = read_frames(frame_filename) joint_angles = read_joint_angles(joint_filename) # Specify logfile name logfile = "output.txt" # Initialise robot programming environment and define reference frames RDK = rl.Robolink() robot = RDK.Item("UR5") world_frame = RDK.Item("UR5 Base") home = RDK.Item("Home") # existing target in station master_tool = RDK.Item("Master Tool") # Set reference frames for robot robot.setPoseFrame(world_frame) robot.setPoseTool(master_tool) # Initialise coffee machine and calculate inverses of required transform matrices machine = CoffeeMachine(robot, master_tool, RDK, frames, joint_angles, logfile) machine.frames[HOME] = home machine.frames[TOOL + TCP] = frames[TCP + TOOL].inv() machine.frames[BALL + TOOL] = machine.frames[TOOL + BALL].inv() machine.frames[FILTER + TOOL] = machine.frames[TOOL + FILTER].inv() machine.frames[PUSHER + TOOL] = machine.frames[TOOL + PUSHER].inv() machine.frames[PULLER + TOOL] = machine.frames[TOOL + PULLER].inv() machine.frames[CUP + TOOL] = machine.frames[TOOL + CUP].inv() # Define constants for operation N = 3 # amount of times leaver needs to be pulled height = 98 # cup height above base of coffee machine time = 12 # Duration to press coffee machine button for scraper_height = 8 # distance from scraper to coffee filter tamp_height = 15 # depth to push filter into tamper # Run coffee making tasks machine.insert_filter_grinder() machine.turn_on_grinder() machine.pull_lever_multiple(N) machine.scrape_filter(scraper_height) machine.tamp_filter(tamp_height) machine.insert_filter_silvia() machine.cup_from_stack() machine.place_cup(height) machine.turn_on_silvia(time) machine.pickup_coffee(height)
def runmain(): RDK = rlk.Robolink() # Get the programs to expand programs = list( filter(lambda item: item.Type() == rlk.ITEM_TYPE_PROGRAM, RDK.Selection())) if len(programs) < 1: RDK.ShowMessage('Please select at least one program.') return for program in programs: # Create a new empty program exp_prog = getExpandedProg(program, RDK) # Inline any sub programs into the new program expandProg(program, exp_prog, RDK, True)
def __init__(self, rdk=None): if rdk is None: self.RDK = robolink.Robolink() else: self.RDK = rdk self.time_last = time.time() if len(sys.argv) > 0: path = sys.argv[0] folder = os.path.basename(os.path.dirname(path)) file = os.path.basename(path) if file.endswith(".py"): file = file[:-3] elif file.endswith(".exe"): file = file[:-4] self.param_name = file + "_" + folder self.RDK.setParam(self.param_name, "1") # makes sure we can run the file separately in debug mode
def runmain(): RDK = rlk.Robolink() # Get the programs to convert programs = list( filter(lambda item: item.Type() == rlk.ITEM_TYPE_PROGRAM, RDK.Selection())) if len(programs) < 1: RDK.ShowMessage('Please select at least one program.') return RDK.Render() RDK.Render(False) for program in programs: # Create a new empty program exp_prog = getConvertedProg(program, RDK) # Convert any sub programs into the new program convertProg(program, exp_prog, RDK) RDK.Render(True)
# Define Imports. import robolink as rl # RoboDK API import robodk as rdk # Robot toolbox import numpy as np # Mathematics toolbox # Set up Robot. RDK = rl.Robolink() robot = RDK.Item('UR5') # Define the robot. world_frame = RDK.Item('UR5 Base') # Define global frame as base of robot. target = RDK.Item('Home') # Existing target in station robot.setPoseFrame(world_frame) robot.setPoseTool(robot.PoseTool()) T_TCP_cup_base_np = np.array([[-1.000000, 0.000000, 0.000000, 1.490000], [0.000000, -1.000000, 0.000000, -600.540000], [0.000000, 0.000000, 1.000000, -20.000000], [0.000000, 0.000000, 0.000000, 1.000000]]) T_cup_base_grabberFrame_np = np.array( [[1.000000, 0.000000, 0.000000, 0.0000], [0.000000, 0.000000, 1.000000, 0.0000], [0.000000, -1.000000, 0.000000, 0.000000], [0.000000, 0.000000, 0.000000, 1.000000]]) T_cup_base_grabberFrame = rdk.Mat(T_cup_base_grabberFrame_np.tolist()) theta_TCP_CT = np.radians(40) T_cup_angle_np = np.array( [[np.cos(theta_TCP_CT), np.sin(theta_TCP_CT), 0.000000, 00.000000], [-np.sin(theta_TCP_CT),
def __init__(self): self.rblink = robolink.Robolink() self.simulation_speed = 1 self.refresh_rate = 0.005