Exemple #1
0
def move_test(con):
    print(f"Running {__file__}::{move_test.__name__}()")
    arm_ctrl = ur.BasicController(con)

    arm = ur.Arm(arm_ctrl)
    ms = 1
    ma = 0.5
    arm.move(target_position=ur.Joints(0, -math.pi / 2, math.pi / 2,
                                       -math.pi / 2, -math.pi / 2, 0),
             max_speed=ms,
             max_acc=ma)
    assert arm.state.is_goal_reached()
    arm.move(target_position=ur.Tool(-0.4, -0.4, 0.2, 0, math.pi, 0),
             max_speed=ms,
             max_acc=ma)
    assert arm.state.is_goal_reached()
    arm.move(target_position=ur.Joints(0, -math.pi / 2, math.pi / 2,
                                       -math.pi / 2, -math.pi / 2, 0),
             max_speed=ms,
             max_acc=ma)
    assert arm.state.is_goal_reached()
    arm.move(target_position=ur.Tool(-0.2, -0.2, 0.3, 0, math.pi, math.pi / 2),
             max_speed=ms,
             max_acc=ma)
    assert arm.state.is_goal_reached()
    arm.move(target_position=ur.Joints(0, -math.pi / 2, math.pi / 2,
                                       -math.pi / 2, -math.pi / 2, 0),
             max_speed=ms,
             max_acc=ma)
    assert arm.state.is_goal_reached()

    print("Tool pose:" + str(arm.state.tool_pose()))
    print("Joint positions:" + str(arm.state.joint_positions()))
    print("Passed.")
def read_test(con):
    print(f"Running {__file__}::{read_test.__name__}()")
    arm_ctrl = ur.BasicController(con)
    cmd = ur.Command()
    state = ur.State()
    arm_ctrl.execute(cmd, state)
    print("Tool pose:" + str(state.tool_pose()))
    print("Joint positions:" + str(state.joint_positions()))
    print("Passed.")   
Exemple #3
0
def move_test(con):
    print(f"Running {__file__}::{move_test.__name__}()")
    con.connect()
    arm_ctrl = ur.BasicController(con)

    arm = ur.Arm(arm_ctrl)
    arm.move(target_position=ur.Joints(0, -math.pi / 2, math.pi / 2, -math.pi /
                                       2, -math.pi / 2, 0))
    assert arm.state.is_goal_reached()
    arm.move(target_position=ur.Tool(-0.4, -0.4, 0.2, 0, math.pi, 0))
    assert arm.state.is_goal_reached()
    arm.move(target_position=ur.Joints(0, -math.pi / 2, math.pi / 2, -math.pi /
                                       2, -math.pi / 2, 0))
    assert arm.state.is_goal_reached()

    print("Tool pose:" + str(arm.state.tool_pose()))
    print("Joint positions:" + str(arm.state.joint_positions()))
    con.disconnect()
    print("Passed.")
def move_test2(con):
    print(f"Running {__file__}::{move_test.__name__}()")
    arm_ctrl = ur.BasicController(con)

    arm = ur.Arm(arm_ctrl)
    arm.move(target_position=ur.Joints(0, -math.pi/2, math.pi/2, -math.pi/2, -math.pi/2, 0))
    assert arm.state.is_goal_reached()

    home = arm.state.tool_pose() + 0
    arm.move(target_position=home)
    assert arm.state.is_goal_reached()

    ms = 1
    ma = 0.5

    next = home + [0, 0, 0.1, 0, 0, math.pi/2]
    #next = home + [0, 0, 0.25, 0, 0, 0]
    arm.move(target_position=next, max_speed=ms, max_acc=ma)
    assert arm.state.is_goal_reached()

    down = home + [0, 0, -0.1, 0, 1, 0]
    arm.move(target_position=down, max_speed=ms, max_acc=ma)
    assert arm.state.is_goal_reached()
    
    arm.move(target_position=next, max_speed=ms, max_acc=ma)
    assert arm.state.is_goal_reached()

    arm.move(target_position=down, max_speed=ms, max_acc=ma)
    assert arm.state.is_goal_reached()

    arm.move(target_position=home,
     max_speed=ms, max_acc=ma)
    assert arm.state.is_goal_reached()

    print("Tool pose:" + str(arm.state.tool_pose()))
    print("Joint positions:" + str(arm.state.joint_positions()))
    print("Passed.")