Breadcrumbs

wait_input()

Definition

wait_input(port_type, index, val, timeout=None, condition=None)

Features

It waits until the signal value received from the digital/analog contact of the controller/flange becomes val. The wait time can be changed with the timeout setting, and the result is returned as soon as the wait state ends after the specified amount of time has elapsed. However, if timeout is not set, it will wait indefinitely.

Caution

The parameters vary depending on the flange board version and robot model, so please check the manual.

Parameters

Parameter Name

Data Type

Default Value

Description

port_type

int

-

type of contact point

  • DR_CONTROLLER_DIGITAL : 0

  • DR_FLANGE_DIGITAL : 1

  • DR_CONTROLLER_ANALOG : 2

  • DR_FLANGE_ANALOG : 3

index

int

-

I/O contact number mounted on the controller(It also serves as a Chnnel for the Analog output)

  • when the port_type is DR_CONTROLLER_DIGITAL

    • Val argument existing: A number between 1 and 20

    • No val argument: 1 ~ 20 , -20 ~ -1 (A positive number means ON while a negative number means OFF.)

    • 17 - 20 (-20 ~ -17) are inputs of the SI1 - SI4 terminals.

  • when the port_type is DR_FLANGE_DIGITAL

    • when the model of robot is M/H with old flange

      • Val argument existing: A number between 1 and 6

      • No val argument: 1 ~ 6 , -1 ~ -6(A positive number means ON while a negative number means OFF.)

    • when the model of robot is A

      • Val argument existing: A number between 1 and 2

      • No val argument: 1 ~ 2 , -1 ~ -2(A positive number means ON while a negative number means OFF.)

    • when the model of robot is M/H with new flange

      • Val argument existing: A number between 1 and 4

      • No val argument: 1 ~ 4, -1 ~ -4(A positive number means ON while a negative number means OFF.)

  • when the port_type is DR_CONTROLLER_ANALOG

    • 1 ~ 2(channel)

  • when the port_type is DR_FLANGE_ANALOG(Only available on new flanges)

    • 1 ~ 2(A model)

    • 1 ~ 4(M/H model)

val

float

-

I/O value

  • when the port_type is 0 or 1(digital)

    • ON : 1

    • OFF : 0

  • when the port_type is 2(analog)

    • current mode : 4.00 ~ 20.00(mA)

    • voltage mode : 0.00 ~ 10.00(V)

timeout

float

None

waiting time [sec]

If not set, wait indefinitely

condition

int

None

Analog value comparison condition

  • DR_ANALOG_CONDITION_UPPER: 0

    • Wait until the received analog input is greater than or equal to the val parameter.

  • DR_ANALOG_CONDITION_LOWER : 1

    • Wait until the received analog input is less than or equal to the val parameter

Note

If val is omitted, positive numbers become ON and negative numbers become OFF depending on the sign (+/-) of the index.

Return

Value

Description

0

Success

-1

Failed(time-out)

Exception

Exception

Description

DR_Error (DR_ERROR_TYPE)

Parameter data type error occurred

DR_Error (DR_ERROR_VALUE)

Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME)

C extension module error occurred

DR_Error (DR_ERROR_STOP)

Program terminated forcefully

Example

Python
wait_input(0, 1, ON) # wait_digital_input(1, ON)
wait_input(1, 2, ON) # wait_tool_digital_input(2, ON)
wait_input(2, 1, 4.0, DR_ANALOG_CONDITION_LOWER) # wait_analog_input(1, DR_ANALOG_CONDITION_LOWER, 4.0)