system/uorb: fix listener_top not showing topic data#3527
Conversation
|
When I try to compile your configuration I get this error: CP: /home/linguini/coding/nuttx-space/nuttx/include/nuttx/config.h
CC: grp/lib_getgrbuf.c generator.c: In function ‘replay_worker’:
generator.c:205:44: error: ‘const struct orb_metadata’ has no member named ‘o_format’
205 | sensor_gen->obj.meta->o_format, data);
| ^~
generator.c: In function ‘fake_worker’:
generator.c:287:38: error: ‘const struct orb_metadata’ has no member named ‘o_format’
287 | sensor_gen->obj.meta->o_format, data) < 0)
| ^~
make[2]: *** [/home/linguini/coding/nuttx-space/apps/Application.mk:330: generator.c.home.linguini.coding.nuttx-space.apps.system.uorb.o] Error 1
make[2]: *** Waiting for unfinished jobs....
IN: mm/libmm.a -> staging/libmm.a make[1]: *** [Makefile:54: /home/linguini/coding/nuttx-space/apps/system/uorb_all] Error 2
make[1]: *** Waiting for unfinished jobs....
CC: pthread/pthread_mutexattr_setpshared.c make: *** [tools/LibTargets.mk:248: /home/linguini/coding/nuttx-space/apps/libapps.a] Error 2
make: *** Waiting for unfinished jobs.... |
c092120 to
3b2a53a
Compare
listener_update() only prints topic data when delta_generation is non-zero (i.e., new data arrived since last check). In listener_top, the first call adds objects to the list, and subsequent calls only print if new data was published between iterations. This results in listener_top -T showing only the header with no topic rows. Fix by always printing the current topic state in listener_update, setting frequency to 0 when no new data arrives. This ensures listener_top displays all topics every iteration. Fixes apache#3202 Signed-off-by: hanzj <hanzhijian@zepp.com>
3b2a53a to
6b10fab
Compare
Sorry for the oversight. The compilation error occurs because generator.c uses o_format to parse sensor data from stdin, but CONFIG_UORB_FORMAT wasn't being selected when only UORB_GENERATOR was enabled. |
|
I must sleep. It's 0:11 now in my zone. |
|
Do you mean Anyways, with your updated config option list I was able to reproduce your results! |

Note: Please adhere to Contributing Guidelines.
Summary
uorb_listener -T(top mode) only displays the header row but no topic data. This is becauselistener_update()only prints topic data whendelta_generation && delta_timeis true (new data arrived since the last check). On the first iteration, objects are added to the list but no data is printed. On subsequent iterations, if no new data has been published between calls,delta_generation == 0and the topic row is silently skipped.Fix by moving the
uorbinfo_raw()call and timestamp/generation update outside the conditional block, and initializingfrequency = 0before the check. This ensures the topic row is always printed, with frequency showing 0 when no new data is available.Fixes apache/nuttx-apps#3202.
Impact
uorb_listener -Ttop mode)Testing
Host: Linux x86_64, sim:nsh
Config:
Steps:
Before fix:
After fix: