Communication

class ingeniamotion.communication.Communication(motion_controller)

Communication.

class Protocol(value)

Communication protocol enum

TCP = 1
UDP = 2
connect_servo_eoe(ip, dict_path=None, alias='default', protocol=<Protocol.UDP: 2>, port=1061)

Connect to target servo by Ethernet over EtherCAT

Parameters
  • ip (str) – servo IP.

  • dict_path (str) – servo dictionary path.

  • 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.

connect_servo_ethernet(ip, dict_path=None, alias='default', protocol=<Protocol.UDP: 2>, port=1061)

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.

  • protocol (Protocol) – UDP or TCP protocol. UDP by default.

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

connect_servo_ecat(ifname, dict_path, slave=1, eoe_comm=True, alias='default')

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 if True, if False use SDOs. True by default.

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

static get_ifname_by_index(index)

Return interface name by index.

Parameters

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

Returns

real name of selected interface. It can be used for function connect_servo_ecat().

Return type

str

static get_interface_name_list()

Get interface list.

Returns

List with interface readable names.

Return type

list of str

connect_servo_ecat_interface_index(if_index, dict_path, slave=1, eoe_comm=True, alias='default')

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 function get_interface_name_list().

  • dict_path (str) – servo dictionary path.

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

  • eoe_comm (bool) – use eoe communications if True, if False use SDOs. True by default.

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

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.

Returns

Current register value.

Return type

int, float or str

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

Set a value of a target register.

Parameters
  • register (str) – register UID.

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

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

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

get_sdo_register(index, subindex, dtype, string_size=None, servo='default')

Return the value via SDO of a target register.

Parameters
  • index (int) – register index.

  • subindex (int) – register subindex.

  • dtype (ingenialink.registers.REG_DTYPE) – register data type.

  • string_size (int) – if register data is a string, size in bytes is mandatory. None by default.

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

Returns

Current register value.

Return type

int, float or str

set_sdo_register(index, subindex, dtype, value, servo='default')

Set the value via SDO of a target register.

Parameters
  • index (int) – register index.

  • subindex (int) – register subindex.

  • dtype (ingenialink.registers.REG_DTYPE) – register data type.

  • value (int or float) – new value for the register.

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