Communication

class ingeniamotion.communication.Communication(motion_controller)

Communication.

connect_servo_eoe(ip, dict_path=None, alias='default', port=1061, servo_status_listener=False, net_status_listener=False)

Connect to target servo by Ethernet over EtherCAT

Parameters
  • ip (str) – servo IP.

  • dict_path (Optional[str]) – servo dictionary path.

  • alias (str) – servo alias to reference it. default by default.

  • port (int) – servo port. 1061 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
Return type

None

connect_servo_ethernet(ip, dict_path, alias='default', port=1061, connection_timeout=1, servo_status_listener=False, net_status_listener=False)

Connect to target servo by Ethernet

Parameters
  • ip (str) – servo IP

  • dict_path (str) – servo dictionary path.

  • alias (str) – servo alias to reference it. default by default.

  • port (int) – servo port. 1061 by default.

  • connection_timeout (int) – Timeout in seconds for connection. 1 seconds 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
Return type

None

connect_servo_eoe_service(ifname, dict_path, ip='192.168.3.22', slave=1, port=1061, alias='default', servo_status_listener=False, net_status_listener=False)

Connect to target servo by Ethernet over EtherCAT

Parameters
  • ifname (str) – interface name. It should have format \Device\NPF_[...].

  • dict_path (str) – servo dictionary path.

  • ip (str) – IP address to be assigned to the servo.

  • slave (int) – slave index. 1 by default.

  • port (int) – servo port. 1061 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
Return type

None

connect_servo_eoe_service_interface_ip(interface_ip, dict_path, ip='192.168.3.22', slave=1, port=1061, alias='default', servo_status_listener=False, net_status_listener=False)

Connect to target servo by Ethernet over EtherCAT

Parameters
  • interface_ip (str) – IP of the interface to be connected to.

  • dict_path (str) – servo dictionary path.

  • ip (str) – IP address to be assigned to the servo.

  • slave (int) – slave index. 1 by default.

  • port (int) – servo port. 1061 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
Return type

None

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 to

  • configured with. (be) –

Raises
  • ValueError – In case the input is not valid or the adapter

  • is not found.

Return type

str

Returns

Ifname of the controller.

static get_ifname_by_index(index)

Return interface name by index.

Parameters

index (int) – position of interface selected in get_interface_name_list().

Return type

str

Returns

Real name of selected interface. It can be used for function connect_servo_eoe_service().

Raises

IndexError – If interface index is out of range.

static get_interface_name_list()

Get interface list.

Return type

List[str]

Returns

List with interface readable names.

connect_servo_eoe_service_interface_index(if_index, dict_path, ip='192.168.3.22', slave=1, port=1061, alias='default', servo_status_listener=False, net_status_listener=False)

Connect to target servo by Ethernet over EtherCAT

Parameters
  • if_index (int) – interface index in list given by function get_interface_name_list().

  • dict_path (str) – servo dictionary path.

  • ip (str) – IP address to be assigned to the servo.

  • slave (int) – slave index. 1 by default.

  • port (int) – servo port. 1061 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
Return type

None

scan_servos_eoe_service(ifname)

Return a list of available servos.

Parameters

ifname (str) – interface name. It should have format \Device\NPF_[...].

Return type

List[int]

Returns

Drives available in the target interface.

Raises

ingenialink.exceptions.ILError – If the EoE service is not running

scan_servos_eoe_service_interface_index(if_index)

Return a list of available servos.

Parameters

if_index (int) – interface index in list given by function get_interface_name_list().

Return type

List[int]

Returns

Drives available in the target interface.

Raises
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 with scan_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
Return type

None

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

List[int]

Returns

List of node ids available in the network.

disconnect(servo='default')

Disconnect servo.

Parameters

servo (str) – servo alias to reference it. default by default.

Return type

None

get_register(register, servo='default', axis=1)

Return the value of a target register.

Parameters
  • register (str) – register UID.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

Return type

Union[int, float, str]

Returns

Current register value.

Raises
set_register(register, value, servo='default', axis=1)

Set a value of a target register.

Parameters
  • register (str) – register UID.

  • value (Union[int, float]) – new value for the register.

  • servo (str) – servo alias to reference it. default by default.

  • axis (int) – servo axis. 1 by default.

Raises
Return type

None

subscribe_net_status(callback, servo='default')

Add a callback to net status change event.

Parameters
  • callback (Callable) – when net status changes callback is called.

  • servo (str) – servo alias to reference it. default by default.

Return type

None

unsubscribe_net_status(callback, servo='default')

Remove net status change event callback.

Parameters
  • callback (Callable) – callback to remove.

  • servo (str) – servo alias to reference it. default by default.

Return type

None

subscribe_servo_status(callback, servo='default')

Add a callback to servo status change event.

Parameters
  • callback (Callable) – when servo status changes callback is called.

  • servo (str) – servo alias to reference it. default by default.

Return type

None

unsubscribe_servo_status(callback, servo='default')

Remove servo status change event callback.

Parameters
  • callback (Callable) – callback to remove.

  • servo (str) – servo alias to reference it. default by default.

Return type

None

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

None

load_firmware_ecat(ifname, fw_file, slave=1)

Load firmware via ECAT.

Parameters
  • ifname (str) – interface name. It should have format \Device\NPF_[...].

  • fw_file (str) – Firmware file path.

  • slave (int) – slave index. 1 by default.

Raises
Return type

None

load_firmware_ecat_interface_index(if_index, fw_file, slave=1)

Load firmware via ECAT.

Parameters
  • if_index (int) – interface index in list given by function get_interface_name_list().

  • fw_file (str) – Firmware file path.

  • slave (int) – slave index. 1 by default.

Raises
Return type

None

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.

Parameters
  • ip (str) – servo IP.

  • fw_file (str) – Firmware file path.

  • ftp_user (Optional[str]) – FTP user to connect with.

  • ftp_pwd (Optional[str]) – FTP password for the given user.

Return type

None

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.

Parameters
  • fw_file (str) – Firmware file path.

  • servo (str) – servo alias to reference it. default by default.

  • ftp_user (Optional[str]) – FTP user to connect with.

  • ftp_pwd (Optional[str]) – FTP password for the given user.

Raises

ValueError – If servo is not connected via Ethernet.

Return type

None

boot_mode(servo='default')

Set servo to boot mode. Servo is disconnected.

Parameters

servo (str) – servo alias to reference it. default by default.

Return type

None