|
Motion Master
|
#include <gtest/gtest.h>#include <chrono>#include <memory>#include <string>#include <thread>#include "loguru.h"#include "soem.h"
Functions | |
| std::unique_ptr< mm::comm::soem::Master > | initMaster (const std::string &iface) |
| Initializes the SOEM master and prepares all connected slaves for operation. | |
| TEST (CommSoemPdoRemappingTestSuite, CirculoInitMasterTest) | |
| TEST (CommSoemPdoRemappingTestSuite, CirculoFailsSdoReadAfterSecondCallToEcxConfigMapGroupTest) | |
| TEST (CommSoemPdoRemappingTestSuite, InitialPdoMappingTest) | |
| TEST (CommSoemPdoRemappingTestSuite, PdoRemappingTest) | |
| TEST (CommSoemPdoRemappingTestSuite, IntegroNoInitialPdoMappingFromMasterSideTest) | |
| TEST (CommSoemPdoRemappingTestSuite, PdoRemapAndReinitFieldbusTest) | |
Variables | |
| const std::string | kIface |
| const size_t | kRxPdoCount = 11 |
| const size_t | kTxPdoCount = 16 |
| const int32_t | kObytes = 35 |
| const int32_t | kIbytes = 47 |
| std::unique_ptr< mm::comm::soem::Master > initMaster | ( | const std::string & | iface | ) |
Initializes the SOEM master and prepares all connected slaves for operation.
This function creates a SOEM master instance using the specified network interface (iface), initializes all connected slaves, and brings each slave through the required EtherCAT states (BOOT, INIT, PRE-OP). It then loads parameter definitions, updates and logs the PDO mappings, and configures the PDO mapping to transition slaves to the OPERATIONAL state.
The function performs the following steps:
| iface | The network interface to be used for initializing the SOEM master (e.g., "eth0"). |
| TEST | ( | CommSoemPdoRemappingTestSuite | , |
| CirculoFailsSdoReadAfterSecondCallToEcxConfigMapGroupTest | ) |
| TEST | ( | CommSoemPdoRemappingTestSuite | , |
| CirculoInitMasterTest | ) |
| TEST | ( | CommSoemPdoRemappingTestSuite | , |
| InitialPdoMappingTest | ) |
| TEST | ( | CommSoemPdoRemappingTestSuite | , |
| IntegroNoInitialPdoMappingFromMasterSideTest | ) |
Integro devices do not include an initial PDO mapping, even though the SoC defines a default one. Therefore, when using Integro devices, the master MUST explicitly configure the initial PDO mapping; otherwise, all values will default to zero. This should be addressed by the SOMANET Software team to ensure that the initially read PDO mapping is correct.
| TEST | ( | CommSoemPdoRemappingTestSuite | , |
| PdoRemapAndReinitFieldbusTest | ) |
This test verifies PDO remapping by destroying and reinitializing the master. It ensures that remapping persists and functions correctly after a full fieldbus reset.
| TEST | ( | CommSoemPdoRemappingTestSuite | , |
| PdoRemappingTest | ) |
This test verifies PDO remapping by adding the Core and Drive temperature entries to the TxPDO objects:
Behavior on different devices:
| const int32_t kIbytes = 47 |
| const std::string kIface |
| const int32_t kObytes = 35 |
| const size_t kRxPdoCount = 11 |
| const size_t kTxPdoCount = 16 |