Conversation
usleep() in main loop under native posix causes the app to stop responding. Changing to zephyr's k_msleep() fixes this.
| while(1){ | ||
| rclc_executor_spin_some(&executor, 100); | ||
| usleep(100000); | ||
| k_msleep(100); |
There was a problem hiding this comment.
hmmm. I'm not sure why. Would you mind enlightening me?
There was a problem hiding this comment.
I'm assuming that with host's usleep() Zephyr doesn't schedule the sleeping thread.
There was a problem hiding this comment.
Your assumption is correct.
This change helped this application work better, but there is still the problem that the ROS and uROS libs use usleep()
Example: modules/lib/rclc/src/rclc/sleep.c
However, I wasn't too concerned about this as it only has to work well enough for CI tests on native_posix builds.
For bare-metal builds Zephyr's usleep() will be used.
There was a problem hiding this comment.
Example: modules/lib/rclc/src/rclc/sleep.c
That's easy to fix. See yashi/rclc#1
| @@ -1 +1,39 @@ | |||
| CONFIG_MAIN_THREAD_PRIORITY=3 | |||
There was a problem hiding this comment.
Would you mind explaining to me why the main thread must be priority 3?
There was a problem hiding this comment.
CONFIG_MAIN_THREAD_PRIORITY=3
comes directly from the original prj.conf file of the micro_ros_zephyr_module application.
There was no indication why it was set to that value in the original project.
I had no reason to change it so left it as is.
| #CONFIG_POSIX_API=y | ||
| #CONFIG_PICOLIBC=y |
There was a problem hiding this comment.
Will do - I will convert all the prj_XXX.conf files to their minimal form.
|
|
||
| #CONFIG_POSIX_API=y | ||
| #CONFIG_PICOLIBC=y | ||
| CONFIG_PTHREAD_IPC=n |
There was a problem hiding this comment.
This is default n if !POSIX_API. Why do we need this?
There was a problem hiding this comment.
I will convert all the prj_XXX.conf files to their minimal form.
yashi
left a comment
There was a problem hiding this comment.
I've wrote this a while ago but didn't publish it. Better late than never.
| while(1){ | ||
| rclc_executor_spin_some(&executor, 100); | ||
| usleep(100000); | ||
| k_msleep(100); |
There was a problem hiding this comment.
Example: modules/lib/rclc/src/rclc/sleep.c
That's easy to fix. See yashi/rclc#1

No description provided.