Skip to content

Get Digital Input State

SUMMARY

Get Digital Input State returns the boolean state of a specified digital input channel on the robot controller (True = HIGH, False = LOW).

SUPPORTED ROBOTS

This skill is currently supported on Universal Robots only. Calling this method on other robot brands will raise a NotImplementedError.

The Skill

python
state = robot.get_digital_in_state(input_id=0)

The Code

Example: Read and Log Digital Input State

Connect to the robot and read the state of digital input channel 0.

python
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots

robot_ip = "192.168.1.2"  # replace with your robot's IP

robot = universal_robots.UniversalRobotsUR10E()
# Connect
robot.connect(ip=robot_ip)

input_id = 0
state = robot.get_digital_in_state(input_id)
logger.success(f"Digital input {input_id} state: {state}")

# Disconnect
robot.disconnect()

The Explanation of the Code

get_digital_in_state reads the state of one digital input channel from the RTDE data stream. input_id selects the channel (0-indexed). Returns True if the input is HIGH and False if LOW.

How to Tune the Parameters

ParameterTypeDefaultDescription
input_idintZero-indexed ID of the digital input channel to read.

Return Value

FieldTypeDescription
stateboolTrue if the input is HIGH, False if LOW.

Where to Use the Skill

  • Read sensor triggers, conveyor presence signals, or safety gate states connected to the robot's digital inputs.

When Not to Use the Skill

Use a different skill when: