Hi @Sgilk, Thank you for your previous assistance. I've resolved the AppArmor error and realized that I hadn't correctly initialized the snapcraft.yaml file with all the necessary plugins. Here's an example of my current initialization: comm::datalayer::IClient* client = getClient(datalayer);
if (client == nullptr)
{
std::cout << "ERROR Client connected" << std::endl;
datalayer.stop();
return 1;
}
result = client->readSync("fieldbuses/ethercat/master/instances/VTEM/realtime_data/output/map", &data);
std::cout << "Read returned: " << result.toString() << std::endl;
result = client->readSync("fieldbuses/ethercat/master/instances/VTEM/realtime_data/input/map", &dataIn);
std::cout << "Read returned: " << result.toString() << std::endl;
std::signal(SIGINT, signalHandler);
// First we have to open the realtimememory, reading the whole outputs.
uint8_t* outData;
std::cout << "Opening some realtime memory" << std::endl;
std::shared_ptr<comm::datalayer::IMemoryUser> output;
result = datalayer.factory()->openMemory(output, "fieldbuses/ethercat/master/instances/VTEM/realtime_data/output");
std::cout << "Open the memory with: " << result.toString() << std::endl;
if (comm::datalayer::STATUS_FAILED(result))
{
std::cout << "Open the memory failed with: " << result.toString() << std::endl;
}
// We can read the Inputs to get a Start trigger for example
uint8_t* inData;
std::cout << "Opening some realtime memory" << std::endl;
std::shared_ptr<comm::datalayer::IMemoryUser> input;
result = datalayer.factory()->openMemory(input, "fieldbuses/ethercat/master/instances/VTEM/realtime_data/input");
std::cout << "Open the memory with: " << result.toString() << std::endl;
if (comm::datalayer::STATUS_FAILED(result) && !g_endProcess)
{
std::cout << "Open the memory failed with: " << result.toString() << std::endl;
} This setup successfully opens the memory with the result DL_OK. However, I encounter an issue with the following section of the code do
{
std::cout << "Try to get MemoryMap" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
result = output->getMemoryMap(data);
std::cout << "Getting MemoryMap with: " << result.toString() << std::endl;
} while (comm::datalayer::STATUS_FAILED(result)); In this part, I receive the error DL_RT_INVALIDMEMORYMAP when attempting to get the MemoryMap. Interestingly, if I comment out this section, I can print the memory map values without any issues. For example, I can find and print details like Name of Output and Bitoffset. Name of Output we found: CPX_FB37/VTEM_8_Valves_48DI_DO_/Outputs.Valve_1_Output_5
Bitoffset: 168 However, when I try to begin access, I face another issue indicated by the result DL_RT_NOTOPEN. Could you help me identify any potential mistakes that might still exist in my implementation? Best regards, Vishnuprasad Prachandabhanu
... View more