Skip to content

Conversation

@Otpvondoiats
Copy link
Contributor

@Otpvondoiats Otpvondoiats commented Jan 15, 2026

Summary

This PR includes three important improvements to the uORB system:

1. unit_test Bug Fix (Commit: a53d032)

Fixed the error message caused by inconsistent definitions of pthread_t on different platforms in the uORB unit test module. Some platforms define pthread_t as a pointer type, while others define it as an integral type, which caused compilation errors or warnings when directly using it in certain contexts.

Changes:

  • Removed problematic code that made assumptions about pthread_t type
  • Modified: system/uorb/test/unit_test.c (6 lines deleted)

2. Merge set_info to orb_advertise_multi_queue_info (Commit: 0295e58)

Merged the set_info functionality into a new unified API orb_advertise_multi_queue_info(), which allows advertising a topic with device information in a single call.

Previous workflow:

  1. Call orb_advertise_multi_queue()
  2. Separately call orb_set_info() to set device information

New workflow:

  1. Call orb_advertise_multi_queue_info() - does both in one step

Changes:

  • Modified: system/uorb/uORB/uORB.c (46 lines changed, 54 insertions, 38 deletions)
  • Modified: system/uorb/uORB/uORB.h (46 lines changed, 54 insertions, 38 deletions)
  • Added new API: orb_advertise_multi_queue_info()
  • Refactored internal implementation to support info parameter

3. Loop Bug Fix in epoll (Commit: d1d8823)

Fixed a critical bug in the uORB epoll implementation where only the first POLLIN event was being processed when multiple events arrived simultaneously.

Problem:
When multiple file descriptors had pending events, the epoll event loop would only handle the first event and exit, leaving subsequent events unprocessed. This caused event loss and application hangs waiting for notifications that were never delivered.

Solution:
Fixed the loop logic to properly iterate through all pending events in a single epoll_wait() call, ensuring all ready file descriptors are serviced.

Changes:

  • Modified: system/uorb/uORB/epoll.c (9 lines changed, 6 insertions, 3 deletions)
  • Fixed event loop iteration logic
  • Ensures all pending POLLIN events are processed

Impact

  • Improves cross-platform compatibility for developers running uORB unit tests
  • Provides a more convenient API for topic advertising with device info
  • Resolves event loss issues in applications using uORB with epoll
  • Makes unit tests more reliable across different target platforms

Testing

grass:/ # uor
uorb_advertise_demo  uorb_downsample      uorb_listener        uorb_rpmsg_test      uorb_unit_test
grass:/ # uorb_listener -n 10 sensor_accel

Mointor objects num:1
object_name:sensor_accel, object_instance:0
sensor_accel(now:98839240):timestamp:98432456,x:0.133652,y:0.318765,z:9.838053,temperature:38.191406
sensor_accel(now:98839499):timestamp:98472286,x:0.227026,y:0.321159,z:9.809322,temperature:38.191406
sensor_accel(now:98839675):timestamp:98512116,x:0.133652,y:0.359466,z:9.785380,temperature:38.191406
sensor_accel(now:98840125):timestamp:98551946,x:0.100133,y:0.292429,z:9.802140,temperature:38.191406
sensor_accel(now:98840283):timestamp:98591776,x:0.157594,y:0.323553,z:9.775804,temperature:38.191406
sensor_accel(now:98840418):timestamp:98631606,x:0.164777,y:0.237362,z:9.811717,temperature:38.191406
sensor_accel(now:98840592):timestamp:98671436,x:0.155200,y:0.306794,z:9.830871,temperature:38.191406
sensor_accel(now:98840761):timestamp:98711266,x:0.102527,y:0.342707,z:9.761438,temperature:38.191406
sensor_accel(now:98840931):timestamp:98751096,x:0.227026,y:0.302006,z:9.809322,temperature:38.191406
sensor_accel(now:98841099):timestamp:98790926,x:0.107316,y:0.285246,z:9.768621,temperature:38.191406
Object name:sensor_accel0, recieved:10
Total number of received Message:10/10
grass:/ #

unit test

grass:/ # uor
uorb_advertise_demo  uorb_downsample      uorb_listener        uorb_rpmsg_test      uorb_unit_test
grass:/ # uorb_unit_test
uORB note: try single-topic support
uORB note: PASS single-topic test
uORB note: PASS orb 10-instances
uORB note: try multi-topic support
uORB note: PASS multi-topic test
uORB note: try multi-topic support subscribing before publishing
uORB note: PASS multi-topic reversed
uORB note: Testing unadvertise
uORB note: Testing multi-topic 2 test (queue simulation)
uORB note: PASS multi-topic 2 test (queue simulation)
uORB note: Testing orb queuing
uORB note:   Testing to write some elements...
uORB note:   Testing overflow...
uORB note:   Testing underflow...
uORB note: PASS orb queuing
uORB note: Testing orb queuing (poll & notify)
TEST PASS
grass:/ #

Otpvondoiats and others added 3 commits January 15, 2026 12:47
Fixed the epoll issue that when multiple events come only the first POLLIN is entered.

Signed-off-by: likun17 <[email protected]>
support new api: orb_advertise_multi_queue_info to advertise topic
with info

Signed-off-by: dongjiuzhu1 <[email protected]>
Fixed the error message caused by inconsistent definitions of pthread_t on different platforms.

Signed-off-by: likun17 <[email protected]>
@Otpvondoiats
Copy link
Contributor Author

depend on apache/nuttx#17824

1 similar comment
@Otpvondoiats
Copy link
Contributor Author

depend on apache/nuttx#17824

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants