I work at a startup (https://www.adinnovations.nl/) that is using ros2 foxy to bring imaging systems to industrial greenhouses in the Netherlands for crop analysis. Recently, we have been looking into micro-ros and seeing if it is a good fit for our operation.
I thought that maybe it would be nice to share our conclusions on the current state of micro-ros with the ROS embedded discourse page! Maybe it will give some new perspectives on where micro-ros should go.
We have a robot that moves in one dimension with an encoder to determine its position along this line. This encoder is attached to a MCU which communicates the position information back to our main device. We also have a MCU connected to a screen and buttons as user interface.
Currently, we have written custom drivers in python using pyserial. These drivers use a very simple handshake approach to initialize the mcu to start its information stream, after which the information is sent to the main computer. Once our ros system has completed its mission, it exits, during which the class destructor of the drivers sends one last message to the MCUs to get them back into their handshaking state.
Considering that micro-ros is written by much more capable people than we currently employ, we have been investigating the use of it to replace our own serial communication approach.
We have been using the micro_ros_arduino interface, since we have experience with arduino and platformio.
Here are the conclusions that we have made!
Advantages:
-
It is no longer needed to write a driver per different MCU system since the micro-ros agent is able to run one agent for multiple serial devices. This makes it easier to add more MCUs in the future!
-
Less code duplication since a driver no longer needs to reflect state machines on MCU.
-
No large changes, besides the deletion of the drivers, is needed to incorporate micro-ros into the rest of the codebase.
Limitations:
-
The configurable parameter setting at startup and logging functionalities available in ROS have not yet been fully established. Logging can be partially done by publishing to /rosout.
-
The largest problem we have encountered is that the agent is too much a black box that does not give any insight into its state. This fact unfortunately makes it very hard to guarantee a safe connection from the main device to the MCU, since the output of the agent is not available. In contrast, with the current custom drivers implementation an exception gets thrown if the connection is broken which we can catch and then bring the ros system into the corresponding shutdown state.
-
If we were to transition to micro-ros, workarounds would be possible such as checking an incoming data stream or checking if the nodes are available. Ideally we think direct feedback from the agent would be preferable.
From our perspective the workarounds needed to mitigate the disadvantages will need an additional node to monitor the state of the MCU connections. This, in a way, negates some of the advantages since it will be similar to a driver node. Either we would need to make a monitor node per MCU; a driver per different MCU functionality; or a large node that monitors all MCUs.
With these conclusions, we have decided to not apply micro-ros to the encoder MCU yet. We are continuing to make a proof of concept for less critical user interface since a loss of connection is not considered a fatal situation for the whole system, while with the encoder that would be the case.
There is a large chance that maybe we are missing a key feature that can mitigate the current disadvantages, so tell me if that is the case!