-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uORB::Publication: automatically obtain ORB_QUEUE_LENGTH from the structure #16012
Conversation
d5f9296
to
53d4817
Compare
There's a bit of a hack on destruction to be aware of. This is because of standalone uses publishing a vehicle_command by stack allocating uORB::PublicationQueued and we need the vehicle_command to still exist. Maybe we need a slightly different approach for this use case? |
It may be feasible to put this destructor in But I think this use case affects the consistency of architecture performance, maybe we should delete this use case later. I think no matter whether the broadcaster exists or not, the subscribers should be able to continue to get the unobtained data and make the system behave consistently. |
I think what could work is leaving it be (skipping unadvertise) if any data was actually published. If the uORB::DeviceNode never published anything and doesn't have any subscribers then it should be deleted on unadvertise. Later the entire uORB shutdown/cleanup story needs to be reviewed as it's largely been ignored due to most people turning off their drones by pulling power abruptly. |
Of course, the data should be kept in DeviceNode. My thoughts are a little different: Current design: Can be modified to: This will be another pull request. |
By the way, in the current design, if a DeviceNode is published by multiple publishers, as long as one of the publishers is destroyed, the DeviceNode will be marked as unadvertised. (Need to record the number of publishers.) |
53d4817
to
eea98d4
Compare
Can this modification be merged? The unadvertise related issues mentioned above will be a new pull request. |
…e size according to the type
… ORB_QUEUE_LENGTH
eea98d4
to
c08dc56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
This commits leads to specific factor. [I'm working with custom board and project based on PX4] in rcS right after this drivers starts I call
before (when PublicationQueued was used) after blinking there is on led stay lighting as expected, now it doesn't. The workaround that works in my case: call first But as I see the PX4 boards probably don't have such code that would call led_control/tune_control or other related commands in row on boot, right? Anyway just a warning. |
@lukegluke PX4-Autopilot/src/modules/uORB/uORBDeviceNode.cpp Lines 547 to 557 in 66edc82
I think the new data should be used when the system starts running, and the queue buffer can be used later. |
Yes, I saw this. And it is also due to Subscription will not subscribe until topic will be advertise:
|
Use the C++ template technique to get the
ORB_QUEUE_LENGTH
in the structure, and return the default value if it does not containORB_QUEUE_LENGTH
.In this way, there is no need to remember whether a topic has a queue,
uORB::Publication
will automatically configure the queue size according to the topic in the *.msg file.