planningiorew.blogg.se

Robotstudio movej
Robotstudio movej














MoveJ ( home ) # Provoke program generation (automatic when RDK is finished) RDK. MoveL ( transl ( 0, 0, APPROACH ) * poseref ) robot. setSpeed ( SPEED_MOVE ) # move back to the approach point, then home: robot. RunInstruction ( "SprayOff", INSTRUCTION_CALL_PROGRAM ) robot.

robotstudio movej

RunInstruction ( "SprayOn", INSTRUCTION_CALL_PROGRAM ) # Stop the tool if we are not doing a dry run if not DRY_RUN : robot. setSpeed ( SPEED_WELD ) if not DRY_RUN : # Activate the spray right after we reached the first point robot. MoveL ( posei ) # Impose weld speed only for the first point if i = 0 : # Set weld speed and activate the gun after reaching the first point robot. # Calculate next position posei = poseref * rotz ( ang ) * transl ( RADIUS, 0, 0 ) * rotz ( - ang ) robot. MoveJ ( transl ( 0, 0, APPROACH ) * poseref ) # make an polygon of n SIDES around the reference target for i in range ( SIDES + 1 ): ang = i * 2 * pi / SIDES #angle: 0, 60, 120. Pose () # move the robot to home, then to an approach position robot.

robotstudio movej

ProgramStart ( PROGRAM_NAME, "", "", robot ) # get the pose of the reference target (4x4 matrix representing position and orientation): poseref = target. setRunMode ( RUN_MODE ) # set the name of the generated program RDK. Item ( '', ITEM_TYPE_ROBOT ) # impose the run mode RDK. Item ( 'Target Reference' ) # get the robot as an item: robot = RDK. # This example shows how RoboDK and the Python GUI tkinter can display graphical user interface to customize program generation according to certain parameters from robolink import * # API to communicate with RoboDK for simulation and offline/online programming from robodk import * # Robotics toolbox for industrial robots # Set up default parameters PROGRAM_NAME = "DoWeld" # Name of the program APPROACH = 300 # Approach distance RADIUS = 200 # Radius of the polygon SPEED_WELD = 50 # Speed in mn/s of the welding path SPEED_MOVE = 200 # Speed in mm/s of the approach/retract movements SIDES = 8 # Number of sides for the polygon DRY_RUN = 1 # If 0, it will generate SprayOn/SprayOff program calls, otherwise it will not activate the tool RUN_MODE = RUNMODE_SIMULATE # Simulation behavior (simulate, generate program or generate the program and send it to the robot) # use RUNMODE_SIMULATE to simulate only # use RUNMODE_MAKE_ROBOTPROG to generate the program # use RUNMODE_MAKE_ROBOTPROG_AND_UPLOAD to generate the program and send it to the robot # Main program def RunProgram (): # Use default global variables global PROGRAM_NAME global APPROACH global RADIUS global SPEED_WELD global SPEED_MOVE global SIDES global DRY_RUN global RUN_MODE # Any interaction with RoboDK must be done through RDK: RDK = Robolink () # get the home target and the welding targets: home = RDK. MoveL ( target_i ) #- # Post multiply: relative to the tool #target_i = target_ref * rotz(ang) * transl(R,0,0) * rotz(-ang) #robot.MoveL(target_i) # move back to the center, then home: robot. setPos ( pos_i ) print ( "Moving to target %i : angle %.1f " % ( i, ang * 180 / pi )) print ( str ( Pose_2_TxyzRxyz ( target_i ))) robot. Pos () pos_i = pos_i + R * cos ( ang ) pos_i = pos_i + R * sin ( ang ) target_i.

robotstudio movej

#- # Movement relative to the reference frame # Create a copy of the target target_i = Mat ( target_ref ) pos_i = target_i.

robotstudio movej

setSpeed ( 200 ) # Set linear speed in mm/s # Set the number of sides of the polygon: n_sides = 6 R = 100 # make a hexagon around reference target: for i in range ( n_sides + 1 ): ang = i * 2 * pi / n_sides #angle: 0, 60, 120. setZoneData ( 10 ) # Set the rounding parameter (Also known as: CNT, APO/C_DIS, ZoneData, Blending radius, cornering.

#Robotstudio movej Offline#

MoveJ ( target_ref ) # It is important to provide the reference frame and the tool frames when generating programs offline robot. Pos () print ( "Drawing a polygon around the target: " ) print ( Pose_2_TxyzRxyz ( target_ref )) # move the robot to the first point: robot. Valid (): raise Exception ( 'No robot selected or available' ) # get the current position of the TCP with respect to the reference frame: # (4x4 matrix representing position and orientation) target_ref = robot. ItemUserPick ( 'Select a robot', ITEM_TYPE_ROBOT ) if not robot. # This macro shows an example to draw a polygon of radius R and n_sides vertices using the RoboDK API for Python from robolink import * # API to communicate with RoboDK for simulation and offline/online programming from robodk import * # Robotics toolbox for industrial robots # Any interaction with RoboDK must be done through RDK: RDK = Robolink () # Select a robot (popup is displayed if more than one robot is available) robot = RDK.














Robotstudio movej