Motion Master
Loading...
Searching...
No Matches
Functions | Variables
soempp_pdo_remapping_test.cc File Reference
#include <gtest/gtest.h>
#include <chrono>
#include <thread>
#include "loguru.h"
#include "soempp.h"
Include dependency graph for soempp_pdo_remapping_test.cc:

Functions

std::unique_ptr< soempp::MasterinitMaster (const std::string &iface)
 Initializes the SOEM master and prepares all connected slaves for operation. More...
 
 TEST (SomeppPdoRemappingTestSuite, CirculoInitMasterTest)
 
 TEST (SoemppPdoRemappingTestSuite, CirculoFailsSdoReadAfterSecondCallToEcxConfigMapGroupTest)
 
 TEST (SoemppPdoRemappingTestSuite, InitialPdoMappingTest)
 
 TEST (SoemppPdoRemappingTestSuite, PdoRemappingTest)
 
 TEST (SomeppPdoRemappingTestSuite, IntegroNoInitialPdoMappingFromMasterSideTest)
 
 TEST (SoemppPdoRemappingTestSuite, 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
 

Function Documentation

◆ initMaster()

std::unique_ptr< soempp::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:

  • Creates a SOEM master using the provided network interface (iface).
  • Initializes all connected slaves.
  • For each slave:
    • Resets firmware and transitions the slave state from BOOT to INIT to PRE-OP sequentially.
    • Loads parameter definitions (without reading values).
    • Reads and logs the initial PDO mappings from the device.
  • Configures PDO mapping and brings all slaves to the OPERATIONAL state.
  • Verifies the operational state of all slaves.
Parameters
ifaceThe network interface to be used for initializing the SOEM master (e.g., "eth0").
Returns
A std::unique_ptr to the fully initialized soempp::Master object.

◆ TEST() [1/6]

TEST ( SoemppPdoRemappingTestSuite  ,
CirculoFailsSdoReadAfterSecondCallToEcxConfigMapGroupTest   
)

◆ TEST() [2/6]

TEST ( SoemppPdoRemappingTestSuite  ,
InitialPdoMappingTest   
)

◆ TEST() [3/6]

TEST ( SoemppPdoRemappingTestSuite  ,
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() [4/6]

TEST ( SoemppPdoRemappingTestSuite  ,
PdoRemappingTest   
)

This test verifies PDO remapping by adding the Core and Drive temperature entries to the TxPDO objects:

  • Core temperature (0x20300120) is added to 0x1A02:02.
  • Drive temperature (0x20310120) is added to 0x1A03:06.

Behavior on different devices:

  • Circulo: Core temperature updates correctly; Drive temperature remains 0.
  • Integro: Neither temperature updates; both remain 0.

◆ TEST() [5/6]

TEST ( SomeppPdoRemappingTestSuite  ,
CirculoInitMasterTest   
)

◆ TEST() [6/6]

TEST ( SomeppPdoRemappingTestSuite  ,
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.

Variable Documentation

◆ kIbytes

const int32_t kIbytes = 47

◆ kIface

const std::string kIface
Initial value:
=
"\\Device\\NPF_{34C565DE-B76B-4DFF-8823-8C93BB33098C}"

◆ kObytes

const int32_t kObytes = 35

◆ kRxPdoCount

const size_t kRxPdoCount = 11

◆ kTxPdoCount

const size_t kTxPdoCount = 16