Communication¶
-
class
ingeniamotion.communication.
Communication
(motion_controller)¶ Communication.
-
connect_servo_eoe
(ip, dict_path=None, alias='default', protocol=<Protocol.UDP: 2>, port=1061, reconnection_retries=None, reconnection_timeout=None, servo_status_listener=False, net_status_listener=False)¶ Connect to target servo by Ethernet over EtherCAT
- Parameters
ip (
str
) – servo IP.alias (
str
) – servo alias to reference it.default
by default.protocol (
Protocol
) – UDP or TCP protocol.UDP
by default.port (
int
) – servo port.1061
by default.reconnection_retries (
Optional
[int
]) – Number of reconnection retried before declaring a connected or disconnected stated.reconnection_timeout (
Optional
[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.
- Raises
TypeError – If the dict_path argument is missing.
FileNotFoundError – If the dict file doesn’t exist.
ingenialink.exceptions.ILError – If the servo’s IP or port is incorrect.
- Return type
-
connect_servo_ethernet
(ip, dict_path=None, alias='default', protocol=<Protocol.UDP: 2>, port=1061, reconnection_retries=None, reconnection_timeout=None, servo_status_listener=False, net_status_listener=False)¶ Connect to target servo by Ethernet
- Parameters
ip (
str
) – servo IPalias (
str
) – servo alias to reference it.default
by default.protocol (
Protocol
) – UDP or TCP protocol.UDP
by default.port (
int
) – servo port.1061
by default.reconnection_retries (
Optional
[int
]) – Number of reconnection retried before declaring a connected or disconnected stated.reconnection_timeout (
Optional
[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.
- Raises
TypeError – If the dict_path argument is missing.
FileNotFoundError – If the dict file doesn’t exist.
ingenialink.exceptions.ILError – If the servo’s IP or port is incorrect.
- Return type
-
connect_servo_ecat
(ifname, dict_path, slave=1, eoe_comm=True, alias='default', reconnection_retries=None, reconnection_timeout=None, servo_status_listener=False, net_status_listener=False)¶ Connect servo by ECAT with embedded master.
- Parameters
ifname (
str
) – interface name. It should have format\Device\NPF_[...]
.dict_path (
str
) – servo dictionary path.slave (
int
) – slave index.1
by default.eoe_comm (
bool
) – use eoe communications ifTrue
, ifFalse
use SDOs.True
by default.alias (
str
) – servo alias to reference it.default
by default.reconnection_retries (
Optional
[int
]) – Number of reconnection retried before declaring a connected or disconnected stated.reconnection_timeout (
Optional
[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.
- Raises
FileNotFoundError – If the dict file doesn’t exist.
ingenialink.exceptions.ILError – If the interface name or the slave index is incorrect.
- Return type
-
connect_servo_ecat_interface_ip
(interface_ip, dict_path, slave=1, eoe_comm=True, alias='default', reconnection_retries=None, reconnection_timeout=None, servo_status_listener=False, net_status_listener=False)¶ Connect servo by ECAT with embedded master.
- Parameters
interface_ip (
str
) – IP of the interface to be connected to.dict_path (
str
) – servo dictionary path.slave (
int
) – slave index.1
by default.eoe_comm (
bool
) – use eoe communications ifTrue
, ifFalse
use SDOs.True
by default.alias (
str
) – servo alias to reference it.default
by default.reconnection_retries (
Optional
[int
]) – Number of reconnection retried beforea connected or disconnected stated. (declaring) –
reconnection_timeout (
Optional
[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.
- Raises
FileNotFoundError – Dictionary file is not found.
ValueError – In case the input is not valid or the adapter
is not found. –
- Return type
-
get_ifname_from_interface_ip
(address)¶ Returns interface name based on the address ip of an interface.
- Parameters
address (
str
) – ip expected adapter is expected toconfigured with. (be) –
- Raises
ValueError – In case the input is not valid or the adapter
is not found. –
- Return type
- Returns
Ifname of the controller.
-
static
get_ifname_by_index
(index)¶ Return interface name by index.
- Parameters
index (
int
) – position of interface selected inget_interface_name_list()
.- Return type
- Returns
Real name of selected interface. It can be used for function
connect_servo_ecat()
.- Raises
IndexError – If interface index is out of range.
-
static
get_interface_name_list
()¶ Get interface list.
-
connect_servo_ecat_interface_index
(if_index, dict_path, slave=1, eoe_comm=True, alias='default', reconnection_retries=None, reconnection_timeout=None, servo_status_listener=False, net_status_listener=False)¶ Connect servo by ECAT with embedded master. Interface should be selected by index of list given in
get_interface_name_list()
.- Parameters
if_index (
int
) – interface index in list given by functionget_interface_name_list()
.dict_path (
str
) – servo dictionary path.slave (
int
) – slave index.1
by default.eoe_comm (
bool
) – use eoe communications ifTrue
, ifFalse
use SDOs.True
by default.alias (
str
) – servo alias to reference it.default
by default.reconnection_retries (
Optional
[int
]) – Number of reconnection retried beforea connected or disconnected stated. (declaring) –
reconnection_timeout (
Optional
[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.
- Raises
FileNotFoundError – If the dict file doesn’t exist.
IndexError – If interface index is out of range.
- Return type
-
scan_servos_ecat
(ifname)¶ Return a list of available servos.
-
scan_servos_ecat_interface_index
(if_index)¶ Return a list of available servos.
- Parameters
if_index (
int
) – interface index in list given by functionget_interface_name_list()
.- Return type
- Returns
Drives available in the target interface.
- Raises
IndexError – If interface index is out of range.
-
connect_servo_canopen
(can_device, dict_path, eds_file, node_id, baudrate=<CAN_BAUDRATE.Baudrate_1M: 1000000>, channel=0, alias='default', servo_status_listener=False, net_status_listener=False)¶ Connect to target servo by CANOpen.
- Parameters
can_device (
CAN_DEVICE
) – CANOpen device type.dict_path (
str
) – servo dictionary path.eds_file (
str
) – EDS file path.node_id (
int
) – node id. It’s posible scan node ids withscan_servos_canopen()
.baudrate (
CAN_BAUDRATE
) – communication baudrate. 1 Mbit/s by default.channel (
int
) – CANopen device channel.0
by default.alias (
str
) – servo alias to reference it.default
by default.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.
- Raises
FileNotFoundError – If either of the dict files doesn’t exist.
ingenialink.exceptions.ILError – If CANOpen device type, node id or channel is incorrect.
- Return type
-
scan_servos_canopen
(can_device, baudrate=<CAN_BAUDRATE.Baudrate_1M: 1000000>, channel=0)¶ Scan CANOpen device network to get all nodes.
- Parameters
can_device (
CAN_DEVICE
) – CANOpen device type.baudrate (
CAN_BAUDRATE
) – communication baudrate. 1 Mbit/s by default.channel (
int
) – CANOpen device channel.0
by default.
- Return type
- Returns
List of node ids available in the network.
-
disconnect
(servo='default')¶ Disconnect servo.
-
get_register
(register, servo='default', axis=1)¶ Return the value of a target register.
- Parameters
- Return type
- Returns
Current register value.
- Raises
ingenialink.exceptions.ILAccessError – If the register access is write-only.
IMRegisterNotExist – If the register doesn’t exist.
-
set_register
(register, value, servo='default', axis=1)¶ Set a value of a target register.
- Parameters
- Raises
TypeError – If the value is of the wrong type.
IMRegisterNotExist – If the register doesn’t exist.
IMRegisterWrongAccess – If the register access is read-only.
- Return type
-
get_sdo_register
(index, subindex, dtype, string_size=None, servo='default')¶ Return the value via SDO of a target register.
- Parameters
- Return type
- Returns
Current register value.
- Raises
TypeError – If string_size is not an int.
-
get_sdo_register_complete_access
(index, size, servo='default')¶ Read register via SDO complete access, return value in bytes.
-
set_sdo_register
(index, subindex, dtype, value, servo='default')¶ Set the value via SDO of a target register.
-
subscribe_net_status
(callback, servo='default')¶ Add a callback to net status change event.
-
unsubscribe_net_status
(callback, servo='default')¶ Remove net status change event callback.
-
subscribe_servo_status
(callback, servo='default')¶ Add a callback to servo status change event.
-
unsubscribe_servo_status
(callback, servo='default')¶ Remove servo status change event callback.
-
load_firmware_canopen
(fw_file, servo='default', status_callback=None, progress_callback=None, error_enabled_callback=None)¶ Load firmware via CANopen.
- Parameters
fw_file (
str
) – Firmware file path.servo (
str
) – servo alias to reference it.default
by default.status_callback (
Optional
[Callable
]) – callback with status.progress_callback (
Optional
[Callable
]) – callback with progress.error_enabled_callback (
Optional
[Callable
]) – callback with errors enabled.
- Raises
ValueError – If servo is not connected via CANopen.
- Return type
-
load_firmware_ecat
(ifname, fw_file, slave=1, boot_in_app=True)¶ Load firmware via ECAT.
-
load_firmware_ecat_interface_index
(if_index, fw_file, slave=1, boot_in_app=True)¶ Load firmware via ECAT.
- Parameters
if_index (
int
) – interface index in list given by functionget_interface_name_list()
.fw_file (
str
) – Firmware file path.slave (
int
) – slave index.1
by default.boot_in_app (
bool
) – If summit series -> True. If capitan series -> False. If custom device -> Contact manufacturer.
- Return type
-
load_firmware_ethernet
(ip, fw_file, ftp_user=None, ftp_pwd=None)¶ Load firmware via Ethernet. Boot mode is needed to load firmware.
Warning
After functions ends, the servo will take a moment to load firmware. During the process, the servo will be not operative.
-
boot_mode_and_load_firmware_ethernet
(fw_file, servo='default', ftp_user=None, ftp_pwd=None)¶ Set servo to boot mode and load firmware. Servo is disconnected.
Warning
After functions ends, the servo will take a moment to load firmware. During the process, the servo will be not operative.
-