I/Os
This file presents the different I/Os - Command functions, I/Os - Enums, I/Os - Niryo Topics & I/Os - Objects available with the Arm API
I/Os - Command functions
- check_ned2_version(func)[source]
Decorator that check the robot version
- check_ned_one_version(func)[source]
Decorator that check the robot version
This section reference all existing functions to control your robot, which include
Getting IOs status
Setting IOs mode
Setting IOs value
All functions to control the robot are accessible via an instance of the class NiryoRobot
robot = NiryoRobot(<robot_ip_address>)
robot.io.set_pin_mode(PinID.GPIO_1A, PinMode.INPUT)
robot.io.digital_write(PinID.GPIO_1A, PinState.HIGH)
...
See examples on Examples Section
List of functions subsections:
- class IO(client)[source]
IO robot functions
Example:
ros_instance = NiryoRos("10.10.10.10") # Hotspot io_interface = IO(ros_instance)
- Parameters
client (NiryoRos) – Niryo ROS client
State functions
- property IO.digital_io_states
Return the value of digital ios.
- Returns
State, Name, Mode of the pin
- Return type
DigitalPinObject
- property IO.get_digital_io_states
Returns the io state client which can be used synchronously or asynchronously to obtain the io states. The io state client returns a list of DigitalPinObject.
Examples:
# Get last value io.get_digital_io_states() io.get_digital_io_states.value # Subscribe a callback def io_callback(io_state): print io_state io.get_digital_io_states.subscribe(io_callback) io.get_digital_io_states.unsubscribe()
- Returns
io state topic instance
- Return type
Read & Write functions
I/Os - Niryo Topics
The use of these functions is explained in the NiryoTopic section. They allow the acquisition of data in real time by callbacks or by direct call.
Name |
Function |
Return type |
---|---|---|
|
|
I/Os - Enums
List of enums:
PinMode
PinState
PinID
- class PinMode(value)[source]
Enumeration of Pin Modes
- OUTPUT = 0
- INPUT = 1
- class PinState(value)[source]
Pin State is either LOW or HIGH
- LOW = False
- HIGH = True
- class PinID(value)[source]
Enumeration of Robot Pins
- GPIO_1A = '1A'
- GPIO_1B = '1B'
- GPIO_1C = '1C'
- GPIO_2A = '2A'
- GPIO_2B = '2B'
- GPIO_2C = '2C'
- SW_1 = 'SW1'
- SW_2 = 'SW2'
- DO1 = 'DO1'
- DO2 = 'DO2'
- DO3 = 'DO3'
- DO4 = 'DO4'
- DI1 = 'DI1'
- DI2 = 'DI2'
- DI3 = 'DI3'
- DI4 = 'DI4'
- DI5 = 'DI5'
- AI1 = 'AI1'
- AI2 = 'AI2'
- AO1 = 'AO1'
- AO2 = 'AO2'