Network
- class ingenialink.ethercat.network.EthercatNetwork(interface_name)[source]
Network for all EtherCAT communications.
- Parameters
interface_name (str) – Interface name to be targeted.
- close_socket()
Closes the established network socket.
- connect_to_slave(target=1, dictionary='', use_eoe_comms=1, reconnection_retries=7, reconnection_timeout=200, servo_status_listener=True, net_status_listener=True)[source]
Connect a slave through an EtherCAT connection.
- Parameters
target (int) – Number of the target slave.
dictionary (str) – Path to the dictionary to be loaded.
use_eoe_comms (int) – Specify which architecture is the target based on.
reconnection_retries (int) – Number of reconnection retried before declaring a connected or disconnected stated.
reconnection_timeout (int) – Time in ms of the reconnection timeout.
servo_status_listener (bool) – Toggle the listener of the servo for its status, errors, faults, etc.
net_status_listener (bool) – Toggle the listener of the network status, connection and disconnection.
- Returns
Instance of the connected servo.
- Return type
- destroy_network()
Destroy network instance.
- disconnect_from_slave(servo)[source]
Disconnects the slave from the network.
- Parameters
servo (EthernetServo) – Instance of the servo connected.
- load_firmware(fw_file, target=1, boot_in_app=True)[source]
Loads a given firmware file to a target.
Warning
Choose the
boot_in_app
flag accordingly to your servo specifications otherwise the servo could enter a blocking state.Warning
It is needed to disconnect the drive(
disconnect_from_slave()
) after loading the firmware since the Servo object’s data will become obsolete.- Parameters
target (int) – Targeted node ID to be loaded.
fw_file (str) – Path to the firmware file.
boot_in_app (bool) – If summit series -> True. If capitan series -> False. If custom device -> Contact manufacturer.
- Raises
ILFirmwareLoadError – The firmware load process fails with an error message.
- scan_slaves()[source]
Scan all the slaves connected in the network.
- Returns
List of number of slaves connected to the network.
- Return type
list
- set_reconnection_retries(retries)
Set the number of reconnection retries in our application.
- Parameters
retries (int) – Number of reconnection retries.
- set_recv_timeout(timeout)
Set receive communications timeout.
- Parameters
timeout (int) – Timeout in ms.
- Returns
Result code.
- Return type
int
- start_status_listener()
Start monitoring network events (CONNECTION/DISCONNECTION).
- stop_status_listener()
Stop monitoring network events (CONNECTION/DISCONNECTION).
- subscribe_to_status(callback)
Calls given function everytime a connection/disconnection event is raised.
- Parameters
callback (function) – Function that will be called every time an event is raised.
- unsubscribe_from_status(callback)
Unsubscribe from state changes.
- Parameters
callback (function) – Callback function.
- interface_name
Interface name used in the network settings.
- Type
str
- servos
List of the connected servos in the network.
- Type
list