PDOs
- class ingenialink.pdo.PDOMap[source]
Abstract class that contains PDO mapping information.
- add_item(item: PDOMapItem) None [source]
Append a new item.
- Parameters:
item – Item to be added.
- add_registers(registers: EthercatRegister | CanopenRegister | List[EthercatRegister | 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: EthercatRegister | CanopenRegister, size_bits: int | None = None) PDOMapItem [source]
Create a new PDOMapItem.
- Parameters:
register – Register object.
size_bits – Register size in bits.
- Returns:
PDO Map item.
- set_item_bytes(data_bytes: bytes) None [source]
Set the items raw data from a byte array.
- Parameters:
data_bytes – Byte array.
- Raises:
ILError – If the length of the received data does not coincide.
- property data_length_bits: int
Length of the map in bits.
- Returns:
Length of the map in bits.
- property data_length_bytes: int
Length of the map in bytes.
- Returns:
Length of the map in bytes.
- property items: List[PDOMapItem]
List of items.
- Returns:
List of items.
- property items_mapping: bytearray
Returns all register item mappings concatenated.
- Returns:
_description_
- Return type:
int
- property map_register_index: int | None
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: 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: None | EthercatRegister | CanopenRegister = None, size_bits: int | None = 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: RegCyclicType
CYCLIC_TX, CYCLIC_RX or CYCLIC_TXRX.
- Type:
Accepted cyclic
- property raw_data_bits: bitarray
Raw data in bits.
- Returns:
Raw data in bits
- Raises:
ILError – If the raw data is empty.
- property raw_data_bytes: bytes
Raw data in bytes.
- Returns:
Raw data in bytes
- Raises:
ILError – If the raw data is empty.
- property register_mapping: bytes
Arrange register information into PDO mapping format.
- Returns:
PDO register mapping format.
- class ingenialink.pdo.PDOServo(target: 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: RPDOMap | None = None, rpdo_map_index: int | None = 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: TPDOMap | None = None, tpdo_map_index: int | None = 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.
- class ingenialink.pdo.RPDOMapItem(register: None | EthercatRegister | CanopenRegister = None, size_bits: int | None = None)[source]
Class to represent RPDO mapping items.
- ACCEPTED_CYCLIC: RegCyclicType = 'CYCLIC_RX'
CYCLIC_TX, CYCLIC_RX or CYCLIC_TXRX.
- Type:
Accepted cyclic
- class ingenialink.pdo.TPDOMapItem(register: None | EthercatRegister | CanopenRegister = None, size_bits: int | None = None)[source]
Class to represent TPDO mapping items.
- ACCEPTED_CYCLIC: RegCyclicType = 'CYCLIC_TX'
CYCLIC_TX, CYCLIC_RX or CYCLIC_TXRX.
- Type:
Accepted cyclic