I would like to get to know MicroROS. Therefore I worked with one of the recommended boards (Olimex STM32-E407) for the last weeks. And I have a few questions.
I really want to know if MicroROS is good enough for my use case. That would be: I use a Robot that right now is not using MicroROS and I want to try it with MicroROS and then decide if with or without is better. My thoughts at the moment are: It should be easier to switch Hardware if the code is already written for MicroROS. It should also be easier to maintain MicroROS code than some code written to use for only one Robot.
I also would like to stop safely. This means I publish a topic e.g. with a bool variable and if the bool is set to true the robot needs to stop. There I want to check if I am fast enough when using MicroROS. My thoughts here are that i either write a multithreaded code where one thread always checks if the bool variable is set to true. And the other approach would be to use multiple executors and let the executor (that has the subscriber to the important topic) most often in the while loop get a turn. Here it does not matter for an Olimex STM32 board which approach to choose but if a CPU with more cores is used a multithreaded aproch would be better.
Is it possible to run more than one APP with MicroROS? I used freeRTOS and Zephyr. And there you select which app to run before building the package. But is it possible to start 2 apps? (Like launch file in ROS1 or Python files in ROS2) Because if it is possible then multithreading is possibly not needed because it would be multithreaded.
I tried to use my apps multithreaded but it is not working as expected. I could not find any Tutorials on how to use MicroROS multithreaded except this: micro-ROS-demos. I tried to build something like that: My Zephyr MircoROS multithreaded app and My freeRTOS MicroROS multithreaded app But there I have the problem that the code does not work as I expected it. For the freeRTOS code, the timer callback will not work. And for the Zephyr code the thread publisher will only publish while there is the publisher in the main function. (comment it and it will not work)
I made a small testcase where I used a simple code with a Timer. With each build, I made the timer faster until it would not get any better. Then I measured it with the "hz" command from ros2. I compared it in freeRTOS and Zephyr. Why is it that freeRTOS was way worse than Zephyr? Are the settings of freeRTOS and Zephyr good out of the box when using them with MicroROS? Or how can I get more out of them?