예제 #1
0
def example_send_joint_speeds(base):

    joint_speeds = Base_pb2.JointSpeeds()

    speeds = [10.0, 0, -10.0, 0, 10.0, 0, -10.0]
    i = 0
    for speed in speeds:
        joint_speed = joint_speeds.joint_speeds.add()
        joint_speed.joint_identifier = i
        joint_speed.value = speed
        joint_speed.duration = 0
        i = i + 1
    print("Sending the joint speeds for 10 seconds...")
    base.SendJointSpeedsCommand(joint_speeds)
    time.sleep(10)

    joint_speeds_stop = Base_pb2.JointSpeeds()

    stop = [0, 0, 0, 0, 0, 0, 0]
    i = 0
    for speed in stop:
        joint_speed = joint_speeds_stop.joint_speeds.add()
        joint_speed.joint_identifier = i
        joint_speed.value = speed
        joint_speed.duration = 0
        i = i + 1

    print("Stopping the robot")
    base.SendJointSpeedsCommand(joint_speeds_stop)
def example_send_joint_speeds(e0,base,speeds=[-18, 0, 0, 0, 0, 0, 0],timer=10):

    joint_speeds = Base_pb2.JointSpeeds()

    # actuator_count = base.GetActuatorCount().count
    # The 7DOF robot will spin in the same direction for 10 seconds
    # if actuator_count == 7:
    # speeds = [-18, 0, 0, 0, 0, 0, 0]
    i = 0
    for speed in speeds:
        joint_speed = joint_speeds.joint_speeds.add()
        joint_speed.joint_identifier = i
        joint_speed.value = speed
        joint_speed.duration = 0
        i = i + 1
    #print ("Sending the joint speeds for 10 seconds...")
    base.SendJointSpeedsCommand(joint_speeds)
    t0=time.time()
    if timer==0:
        return True #robot ist still running and stopped in parent function
    else:
        while time.time()-t0<timer and e0.is_set()==False: #success_flag_shared.value==False:
            time.sleep(0.1)
        print ("Stopping the robot")
        base.Stop()
        return True
예제 #3
0
def joint_speed_command(base_client_service, j_id, value):

    speeds = Base_pb2.JointSpeeds()
    act_count = base_client_service.GetActuatorCount()
    js = speeds.joint_speeds.add()
    js.joint_identifier = j_id
    js.value = value
def set_joint_speeds(base,j_speed_setting=5):
    #The Function does nothing ...
    #j_speed_setting=5 #degrees/second
    joint_speeds_=Base_pb2.JointSpeeds()
    joint_speeds_.duration=0
    for i0 in range(7):
        axis0=joint_speeds_.joint_speeds.add()
        axis0.joint_identifier=i0
        axis0.value=j_speed_setting
        axis0.duration=0
    base.SendJointSpeedsCommand(joint_speeds_)
예제 #5
0
def example_send_joint_speeds(base):

    joint_speeds = Base_pb2.JointSpeeds()

    actuator_count = base.GetActuatorCount().count
    # The 7DOF robot will spin in the same direction for 10 seconds
    if actuator_count == 7:
        speeds = [SPEED, 0, -SPEED, 0, SPEED, 0, -SPEED]
        i = 0
        for speed in speeds:
            joint_speed = joint_speeds.joint_speeds.add()
            joint_speed.joint_identifier = i
            joint_speed.value = speed
            joint_speed.duration = 0
            i = i + 1
        print("Sending the joint speeds for 10 seconds...")
        base.SendJointSpeedsCommand(joint_speeds)
        time.sleep(10)
    # The 6 DOF robot will alternate between 4 spins, each for 2.5 seconds
    if actuator_count == 6:
        print("Sending the joint speeds for 10 seconds...")
        for times in range(4):
            del joint_speeds.joint_speeds[:]
            if times % 2:
                speeds = [-SPEED, 0.0, 0.0, SPEED, 0.0, 0.0]
            else:
                speeds = [SPEED, 0.0, 0.0, -SPEED, 0.0, 0.0]
            i = 0
            for speed in speeds:
                joint_speed = joint_speeds.joint_speeds.add()
                joint_speed.joint_identifier = i
                joint_speed.value = speed
                joint_speed.duration = 0
                i = i + 1

            base.SendJointSpeedsCommand(joint_speeds)
            time.sleep(2.5)

    print("Stopping the robot")
    base.Stop()

    return True