Open N-K1998 opened 9 months ago
Avoid using rclc_executor_spin
in embedded systems, it can freeze your scheduler.
Use this approach:
while(1){
delay execution for letting other tasks to run
spin some the rclc executor
}
Just a question. If I define a custom transport in the microros thread task like this:
static void microros_thread_custom( void *pvParameters ){
// set custom transport
rmw_uros_set_custom_transport(
false, // Framing disable here
(void *) NULL, // transport->args
shm_transport_open,
shm_transport_close,
shm_transport_write,
shm_transport_read);
// whatever code
}
And then in the transport_read i call a blocking task operation like:
size_t shm_transport_read(struct uxrCustomTransport* transport, uint8_t* buf, size_t len, int timeout, uint8_t* err){
// Whatever
vTaskDelay(x10second);
// Whatever
}
Does this operation affect the execution of the main thread? The main thread won't execute until the end of the delay inside the read or will it normally continue its execution?
yes, if you block in the read operation it will block the spin.
And also the main thread that has set the custom transport?
no, the read operation happens inside the spin, so only is blocked the task that runs the spin.
Issue template
I am trying to define a pub/sub node on microros. Using the following code the execution stops at rclc_executor_spin. Is there something wrong with the initialization?