Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

multi-threading for nuttx #29

@JanStaschulat

Description

@JanStaschulat

Hi,

@jamoralp @pablogs9 @ralph-lange

I am running into problems for an application with multiple threads for NuttX and Olimex board. You know, that I try to get the multi-threaded executor for NuttX running.
What I have done so far:

  • I tested the multi-threaded exectutor under Linux (Ubuntu 18.04, local Foxy installation), which works.
  • I tested single-threaded executor with a ping-pong example (communication of Agent (linux, Ubuntu 18.04, Foxy) and Olimex/NuttX , branch Foxy works
  • Now I am trying to get the multi-threading executor running with micro-ros on the Olimex board. The high level concept of multithreadd executor (with single-threaded access to RCL):
    • There is one executor thread, which accesses RCL layer (rcl_wait, rcl_take)
    • The executor thread spawns one thread for every subscription
    • If a new message arrives (tested with rcl_wait) , then it takes the data (with rcl_take), copies it and signals the worker thread to start, which will then call the callback of the subscription (using condition variables and locks)

When I try to run it on Olimex board, the threads start, but there is no progress in the main thread (aka executor).
The application uses two subscriptions and two publishers and one executor. So I don't need to change anything in the micro-ros configuration, right?

RCCHECK(rclc_executor_start_multi_threading_for_nuttx(&high_executor));

The processing just stops after calling rcl_wait
https://github.com/micro-ROS/rclc/blob/7a5d0d254f4dbf744b04f46a14fd05de061bbeb3/rclc/src/rclc/executor.c#L1559

However, rcl_wait might not be the problem - maybe something goes wrong with the other threads and then everything stops.
I configured also the priorities:

I also noticed that sometimes the green light on the Olimex board starts blinking. after that not output is seen in the nsh shell (via screen terminal). What does that mean? Something really went wrong?

I wrote a simple program a main thread and two worker threads, which seems to works fine (without micro-ros functions used).

Is there anything regarding STACKSIZE I have to consider? Currently it is set to 65000 in the Makefile

When spawning threads (pthread_create), then no stack size is configured. What is the default stack size. Is it maybe too small, too large?

rclc executor:
https://github.com/micro-ROS/rclc/tree/feature/rbs-nuttx

application on olimex:
https://github.com/micro-ROS/nuttx_apps/tree/feature/foxy_rbs_executor_demo/examples/uros_rbs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions