Open GlingK opened 1 year ago
Probably you will need to use FreeRTOS to notify a task from the IRQ to publish from a task context.
Let us know if notifying a task from an IRQ is a valid approach for you: https://www.freertos.org/xTaskNotifyFromISR.html
I've tried to implement a simple interrupt -> publish application and I've encountered issues making it difficult. What I originally tried is the same as what @pablogs9 recommended: have an ISR notify a suspended task with xTaskNotifyFromISR
, and have that task publish a ROS message. Because that suspended task is not the same task as the micro-ROS task, it's unsafe to publish a message from it without enabling the UCLIENT_PROFILE_MULTITHREAD
build flag. However, as reported in #155, enabling that flag is not possible.
I've resorted to running an rclc timer that publishes the message periodically, and setting the fields in the message from the ISR, however this either adds a delay to when the message is published because of the timer, or wastes processing on a faster timer to get the necessary reactivity.
I'm trying to have micro ros publish sensor information when an ESP32 pin is interrupt. So far,
How would one go about using micro-ros with interrupts? I've try searching around, but didn't find any sample code. Any guidance is much appreciated.