Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions prj_native_posix.conf
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
CONFIG_MICROROS_AGENT_IP="192.168.1.42"
# CONFIG_NET_IPV6 is not set
CONFIG_MICRO_XRCE_DDS_CLIENT_CUSTOM=y
CONFIG_MAIN_THREAD_PRIORITY=3
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind explaining to me why the main thread must be priority 3?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_MAIN_STACK_SIZE=25000
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
CONFIG_CONSOLE=y
CONFIG_CPLUSPLUS=y
CONFIG_NETWORKING=y
CONFIG_NET_SHELL=y
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_NET_PKT_RX_COUNT=32
CONFIG_NET_PKT_TX_COUNT=32
CONFIG_NET_BUF_RX_COUNT=32
CONFIG_NET_BUF_TX_COUNT=32
CONFIG_NET_STATISTICS=y
CONFIG_NET_LOG=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
21 changes: 21 additions & 0 deletions prj_native_posix_64.conf
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
CONFIG_MICROROS_AGENT_IP="192.168.1.42"
# CONFIG_NET_IPV6 is not set
CONFIG_MICRO_XRCE_DDS_CLIENT_CUSTOM=y
CONFIG_BOARD_NATIVE_POSIX_64BIT=y
CONFIG_MAIN_THREAD_PRIORITY=3
CONFIG_MAIN_STACK_SIZE=25000
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000
CONFIG_CONSOLE=y
CONFIG_CPLUSPLUS=y
CONFIG_NETWORKING=y
CONFIG_NET_SHELL=y
CONFIG_NET_MAX_CONTEXTS=10
CONFIG_NET_PKT_RX_COUNT=32
CONFIG_NET_PKT_TX_COUNT=32
CONFIG_NET_BUF_RX_COUNT=32
CONFIG_NET_BUF_TX_COUNT=32
CONFIG_NET_STATISTICS=y
CONFIG_NET_LOG=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
30 changes: 19 additions & 11 deletions prj_nucleo_f429zi.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
CONFIG_ETH_DRIVER=y
CONFIG_MAIN_THREAD_PRIORITY=3
CONFIG_MICROROS_AGENT_IP="192.168.1.42"
CONFIG_GPIO=y
CONFIG_PINCTRL=y
CONFIG_CLOCK_CONTROL=y
CONFIG_SERIAL=y
CONFIG_MAIN_STACK_SIZE=25000

CONFIG_POSIX_API=y
CONFIG_MICRO_XRCE_DDS_CLIENT_CUSTOM=y
CONFIG_SOC_SERIES_STM32F4X=y
CONFIG_SOC_STM32F429XX=y
CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y
CONFIG_MAIN_THREAD_PRIORITY=3
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_ENTROPY_STM32_THR_THRESHOLD=4
CONFIG_ENTROPY_STM32_ISR_THRESHOLD=12
CONFIG_PICOLIBC=y
CONFIG_PTHREAD_IPC=n

CONFIG_POSIX_API=y
# CONFIG_PTHREAD_IPC is not set
CONFIG_CPLUSPLUS=y
CONFIG_MICROROS_AGENT_IP="192.168.1.42"
CONFIG_MICRO_XRCE_DDS_CLIENT_CUSTOM=y

CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_SOCKETS=y
12 changes: 7 additions & 5 deletions prj_qemu_cortex_m3.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# CONFIG_NET_IPV6 is not set
# CONFIG_ETH_DRIVER is not set
#CONFIG_MINIMAL_LIBC_RAND=y
#CONFIG_MINIMAL_LIBC_STRING_ERROR_TABLE=y
CONFIG_POSIX_API=y
CONFIG_SERIAL=y
CONFIG_QEMU_ICOUNT_SHIFT=6
CONFIG_SOC_TI_LM3S6965=y
CONFIG_SCHED_MULTIQ=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_PICOLIBC=y
CONFIG_POSIX_API=y
CONFIG_CPLUSPLUS=y
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void main(void)

while(1){
rclc_executor_spin_some(&executor, 100);
usleep(100000);
k_msleep(100);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm. I'm not sure why. Would you mind enlightening me?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming that with host's usleep() Zephyr doesn't schedule the sleeping thread.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example: modules/lib/rclc/src/rclc/sleep.c

That's easy to fix. See yashi/rclc#1

}

// free resources
Expand Down