Discussion

Left ArrowBack to discussions page
rstuartrstuart Posts: 3 Apprentice
edited April 5 in Programming
I am working on my first UR project. I need the ability to read joint positions and have the robot use thise positions to move to a safe start point as to not collide with anything. Can someone help me with the best way of doing this? Thanks!

Comments

  • mhowemhowe Posts: 41Partner, Wrist Camera URCap 1.3.0 Handy
    1. Read current position, save in variable
    2. Define new pose variable
    The example is having the robot only change in the Z direction.

    BeforeStartSequence

         cp = get_actual_tcp_pose()

         z = cp[2]

         safe_pos = p[cp[0], cp[1], 0.4, cp[3], cp[4], cp[5]]

         Wait 1

         MoveL

              safe_pos

    Robot Program

         Halt


  • JopsonLJopsonL Posts: 12 Apprentice
    edited April 5
    The way i created a homing program was by setting a variable to every way point and then setting the variable to one when the robot moves to that certain way point, off this i could write a subprogram which would move the robot home using way points. Don't forget to set the variable back to zero after each way point. 

    If you have your home position in before start then change it to a relative position instead of fixed position. The robot would not home unless this was set, unsure why. 

    Set these as installation variables. 
    RobotTracker
    currentSubProg

    Below is a portion of the program which is relevant to the homing of the robot. 

     Program
       BeforeStart
         Home_Tracker≔'Is the robot at home?'
         If Home_Tracker ≟  True 
           RobotTracker≔1                      
           currentSubProg≔1                
         MoveJ
           Home_position                         //this is the way point which is set to fixed position 

     Robot Program
         If currentSubProg ≟ 1
           Call part_pick
           Call move_to_tool
           Call Load_unload_part
           Call move_to_conveyor
           Call deposit_on_conveyor
           If Stop_request≥1 and ppcount≟0
             Set Conveyor_Forwd=Off
             Halt
         ElseIf currentSubProg ≟ 2
           Call Homing_Function
       Event Home_Button ≟  True  
         currentSubProg≔2
         Wait: 5.0
         sync()

     Homing_Function
         'Homing from Part Pick'
         If RobotTracker≟1
           MoveJ
             Above_pallet
             Home_position_1
             RobotTracker≔0
             StopVar≔1
         'Homing from Move To Tool'
         If RobotTracker≟2
           MoveJ
             Ready_to_load
             Clear_door_pos2
             Clear_door_pos1
             Home_position_2
             RobotTracker≔0
             StopVar≔1
         ElseIf RobotTracker≟3
           MoveJ
             Clear_door_pos2
             Clear_door_pos1
             Home_position_3
             RobotTracker≔0
             StopVar≔1
    currentSubProg≔1 
    If StopVar≟1
            StopVar≔0
            Halt


    Hope this makes sense. 
Sign In or Register to comment.
Left ArrowBack to discussions page