PDOs

class ingenialink.pdo.PDOMap[source]

Abstract class that contains PDO mapping information.

add_item(item: ingenialink.pdo.PDOMapItem)None[source]

Append a new item.

Parameters

item – Item to be added.

add_registers(registers: Union[ingenialink.ethercat.register.EthercatRegister, ingenialink.canopen.register.CanopenRegister, List[Union[ingenialink.ethercat.register.EthercatRegister, ingenialink.canopen.register.CanopenRegister]]])None[source]

Add a register or a list of registers in bulk.

It creates a new item for each register and adds it the items attribute.

Parameters

registers – Register object or list of Registers.

create_item(register: Union[ingenialink.ethercat.register.EthercatRegister, ingenialink.canopen.register.CanopenRegister], size_bits: Optional[int] = None)ingenialink.pdo.PDOMapItem[source]

Create a new PDOMapItem.

Parameters
  • register – Register object.

  • size_bits – Register size in bits.

Returns

PDO Map item.

property data_length_bits

Length of the map in bits.

Returns

Length of the map in bits.

property data_length_bytes

Length of the map in bytes.

Returns

Length of the map in bytes.

property items

List of items.

Returns

List of items.

property items_mapping

Returns all register item mappings concatenated.

Returns

_description_

Return type

int

property map_register_index

Index of the mapping register. None if it is not mapped in the slave.

Returns

Index of the mapping register.

property map_register_index_bytes

Index of the mapping register in bytes.

Returns

Index of the mapping register in bytes.

Raises

ValueError – If map_register_index is None

class ingenialink.pdo.PDOMapItem(register: Union[None, ingenialink.ethercat.register.EthercatRegister, ingenialink.canopen.register.CanopenRegister] = None, size_bits: Optional[int] = None)[source]

Abstract class to represent a register in the PDO mapping.

register

mapped register object. If None the item will padding.

size_bits

custom register size in bits.

Raises
  • ValueError – If the register and size_bits are not provided.

  • ValueError – If the size_bits value is invalid. Only when the register

  • is set to None.

ACCEPTED_CYCLIC: ingenialink.enums.register.RegCyclicType

CYCLIC_TX, CYCLIC_RX or CYCLIC_TXRX.

Type

Accepted cyclic

property raw_data_bits

Raw data in bits.

Returns

Raw data in bits

Raises

ILError – If the raw data is empty.

property raw_data_bytes

Raw data in bytes.

Returns

Raw data in bytes

Raises

ILError – If the raw data is empty.

property register_mapping

Arrange register information into PDO mapping format.

Returns

PDO register mapping format.

property value

Register value. Converts the raw data bytes into the register value.

Raises
  • ILError – If the raw data is empty.

  • ILError – If the register type is not int or float.

Returns

Register value.

class ingenialink.pdo.PDOServo(target: Union[int, str], dictionary_path: str, servo_status_listener: bool = False)[source]

Abstract class to implement PDOs in a Servo class.

generate_pdo_outputs()None[source]

Process the PDO outputs.

It should call _process_tpdo method using the received bytes as argument.

map_pdos(slave_index: int)None[source]

Map RPDO and TPDO register into the slave.

Parameters

slave_index – salve index.

map_rpdos()None[source]

Map the RPDO registers into the servo slave. It takes the first available RPDO assignment slot of the slave.

Raises

ILError – If there are no available PDOs.

map_tpdos()None[source]

Map the TPDO registers into the servo slave. It takes the first available TPDO assignment slot of the slave.

Raises

ILError – If there are no available PDOs.

process_pdo_inputs()None[source]

Process the PDO inputs.

It should call _process_rpdo method to obtain the bytes to be sent to the slave.

remove_rpdo_map(rpdo_map: Optional[ingenialink.pdo.RPDOMap] = None, rpdo_map_index: Optional[int] = None)None[source]

Remove a RPDOMap from the RPDOMap list.

Parameters
  • rpdo_map – The RPDOMap instance to be removed.

  • rpdo_map_index – The index of the RPDOMap list to be removed.

Raises
  • ValueError – If the RPDOMap instance is not in the RPDOMap list.

  • IndexError – If the index is out of range.

remove_tpdo_map(tpdo_map: Optional[ingenialink.pdo.TPDOMap] = None, tpdo_map_index: Optional[int] = None)None[source]

Remove a TPDOMap from the TPDOMap list.

Parameters
  • tpdo_map – The TPDOMap instance to be removed.

  • tpdo_map_index – The index of the TPDOMap list to be removed.

Raises
  • ValueError – If the TPDOMap instance is not in the TPDOMap list.

  • IndexError – If the index is out of range.

reset_pdo_mapping()None[source]

Reset the RPDO and TPDO mapping in the slave.

reset_rpdo_mapping()None[source]

Delete the RPDO mapping stored in the servo slave.

reset_tpdo_mapping()None[source]

Delete the TPDO mapping stored in the servo slave.

set_pdo_map_to_slave(rpdo_maps: List[ingenialink.pdo.RPDOMap], tpdo_maps: List[ingenialink.pdo.TPDOMap])None[source]

Callback called by the slave to configure the map.

Parameters
  • rpdo_maps – List of RPDO maps.

  • tpdo_maps – List of TPDO maps.

class ingenialink.pdo.RPDOMap[source]

Class to store RPDO mapping information.

get_item_bits()bitarray.bitarray[source]

Return the concatenated items raw data to be sent to the slave (in bits).

Raises
  • ILError – Raw data is empty.

  • ILError – If the length of the bit array is incorrect.

Returns

Concatenated items raw data in bits.

get_item_bytes()bytes[source]

Return the concatenated items raw data to be sent to the slave (in bytes).

Raises
  • ILError – Raw data is empty.

  • ILError – If the length of th byte array is incorrect.

Returns

Concatenated items raw data in bytes.

class ingenialink.pdo.RPDOMapItem(register: Union[None, ingenialink.ethercat.register.EthercatRegister, ingenialink.canopen.register.CanopenRegister] = None, size_bits: Optional[int] = None)[source]

Class to represent RPDO mapping items.

property value

Register value. Converts the raw data bytes into the register value.

Raises
  • ILError – If the raw data is empty.

  • ILError – If the register type is not int or float.

Returns

Register value.

class ingenialink.pdo.TPDOMap[source]

Class to store TPDO mapping information.

set_item_bytes(data_bytes: bytes)None[source]

Set the items raw data from a byte array received from the slave.

Parameters

data_bytes – Byte array received from the slave.

Raises

ILError – If the length of the received data does not coincide.

class ingenialink.pdo.TPDOMapItem(register: Union[None, ingenialink.ethercat.register.EthercatRegister, ingenialink.canopen.register.CanopenRegister] = None, size_bits: Optional[int] = None)[source]

Class to represent TPDO mapping items.