Improve the network_simulator and EsiParser#386
Conversation
…mpliance with official Beckhoff EtherCAT modules
|
I though ESI should only handle one slave but ENI multiple as it describes a network? If yes we need a deidcated parser (ENIParser) Answering to myself: yes an ESI can have multiple slaves |
| // In many Beckhoff BIN files, the Identity section starts at Word 8 (Byte 16) | ||
|
|
||
| // Vendor ID (Word 8 & 9) | ||
| vendor_id_ = (static_cast<uint32_t>(eeprom_[9]) << 16) | eeprom_[8]; |
There was a problem hiding this comment.
I wonder if it is better to use the SII Parser to extract the data needed here (it can also verify the eeprom coherency).
|
|
||
| nanoseconds t1 = since_epoch(); | ||
| CoE::Dictionary coe_dict = parser.loadFile(esi_file); | ||
| CoE::Dictionary coe_dict = parser.loadFirstDictionaryFromFile(esi_file); |
There was a problem hiding this comment.
Is it to handle legacy call? If yes I think it is better to just have one API that retrieve the vector of dic and let each example get themself the first one (they are examples after all :) )
| @@ -147,7 +147,7 @@ namespace kickcat | |||
| CoE::Dictionary loadOD(std::string esiFileName) | |||
There was a problem hiding this comment.
Unrelated to you PR but could you convert this call to loadOD(std::string const& esiFileName)` ?
| } | ||
|
|
||
| #endif | ||
| #endif No newline at end of file |
There was a problem hiding this comment.
| #endif | |
| #endif | |
This modification is making the KickCAT more compliance with the official Beckhoff EtherCAT module. So the XML file from Beckhoff can contain several EtherCAT devices (e.g. EL1xxx.xml) but the EEPROM BIN only contains 1 device. With these changes, the program will get the vendor_id, product_code, and revision_number from the EEPROM BIN. From that, the program go look into the xml file until it find the matching vendor_id, product_code, and revision_number instead of finding the first elements.
Also I agree with the ENI vs ESI seperation because for example the EL1xxx modules need a EtherCAT bus coupler infront of it. It's more convenient to have a .json file that contains whole network instead of
-s <EtherCAT coupler (EK1xxx)>.json <EL1xxx>.json