embedded-software-laboratory / embeddedRTPS-STM32

29 stars 16 forks source link

`embedded_rtps_test` seems to work only 3 times #7

Closed takasehideki closed 3 years ago

takasehideki commented 3 years ago

Hi, authors! Thank you so much for publishing the awesome software!!

When we try to run the example several times in a row on this repo, embedded_rtps_test seems to work only 3 times. According to our observation, it seems that the pointer to reader cannot be acquired at the below point (proxy cannot be acquired) in the 4th execution.

https://github.com/tlk-emb/embeddedRTPS/blob/397b9d92b47d9bd7f079204076fca0ca9e1fa60f/include/rtps/entities/StatefulWriter.tpp#L210-L218

  if (reader == nullptr) {
#if SFW_VERBOSE
    log("StatefulWriter[%s]: No proxy found with id: ",
        &this->m_attributes.topicName[0]);
    printEntityId(msg.readerId);
    log(" Dropping acknack.\n");
#endif
    return;
  }

We couldn't figure out the cause any more. Please let us know if you have any knowledge.


BTW, one more supplemental question. Is there a way to debug with serial output? We found some macros that seem to enable printf debugging, e.g., THREAD_POOL_VERBOSE and SFW_VERBOSE. However, the serial output could not be observed even if we changed these values.

akampmann commented 3 years ago

Hi takasehideki,

would you mind sharing the code where you try to run the test multiple times in a row?

Regarding your second question. The logging functions were used for the Infineon Aurix implementation, where we were using a TFT Display connected to the controller for output. I'm afraid you need to change the implementation of the log() to output to serial port: https://github.com/embedded-software-laboratory/embeddedRTPS/blob/master/include/rtps/utils/Log.h

I'm afraid the usage of log() may not be consistent in every part of embeddedRTPS.

Best regards, Alex

takasehideki commented 3 years ago

Hi, Alex @akampmann thank you for your kind response!

For the main question, we have not changed anything from the master branch of this repository except for the IP setting.

For the question for log(), since the problem seems to be in the .tpp file, it's difficult to set the breakpoints. Therefore, we are trying to debug with printf. We could understand how you did the log debugging. We were wondering why you were using USART6, but now it's clear. I think we can switch to serial output using printf. I will try it and share it to you soon.

akampmann commented 3 years ago

Hi @takasehideki,

embeddedRTPS does not drop remote participants if they become inactive. If you keep adding remote participants by restarting the application on the Linux side, you will hit limits specified in the config.h file. In your case, it should be

const uint8_t NUM_WRITER_PROXIES_PER_READER = 3; const uint8_t NUM_READER_PROXIES_PER_WRITER = 3;

Can you try to increase those?

Determining liveliness of remote participants is a missing feature and should be added.

Regarding logging: you can specify the IDE to treat .tpp files as files containing C++ code, setting breakpoints should then be no problem.

takasehideki commented 3 years ago

@akampmann awesome! By changing these values, embedded_rtps_test could be worked more than 3 times!! We fully understood the cause of this issue and how to do about it. We will also consider better way.

Again, thank you so much for your cooperation :D

takasehideki commented 3 years ago

@akampmann By the way, are you interested in supporting debug with printf? Although It is not completely done yet, we can send PR when it's complete.

akampmann commented 3 years ago

Sure, you are welcome to send a PR for that feature.