uORB: make queue size (ORB_QUEUE_LENGTH) completely static (#22815)

Previously uORB queue size was an awkward mix of runtime configurable (at advertise or IOCTL before allocate), but effectively static with all queue size settings (outside of test code) actually coming from the topic declaration (presently ORB_QUEUE_LENGTH in the .msg). This change finally resolves the inconsistency making the queue size fully static.

Additionally there were some corner cases that the muorb and orb communicator implementation were not correctly handling. This PR provides fixes for those issues. Also correctly sets remote queue lengths now based on the topic definitions.

* Made setting of uORB topic queue size in based on topic definition only
* Fixes to the ModalAI muorb implementation
* Removed libfc sensor from format checks
* msg/TransponderReport.msg ORB_QUEUE_LENGTH 8->16 (was set to higher in AdsbConflict.h

---------

Co-authored-by: Eric Katzfey <eric.katzfey@modalai.com>
Co-authored-by: Daniel Agar <daniel@agar.ca>
This commit is contained in:
Eric Katzfey
2024-03-08 16:28:24 -05:00
committed by GitHub
co-authored by Eric Katzfey Daniel Agar
parent 006dcfafb7
commit 57df7e35b2
28 changed files with 108 additions and 228 deletions
+7 -16
View File
@@ -62,7 +62,7 @@ class UnitTest;
class uORB::DeviceNode : public cdev::CDev, public IntrusiveSortedListNode<uORB::DeviceNode *>
{
public:
DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path, uint8_t queue_size = 1);
DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path);
virtual ~DeviceNode();
// no copy, assignment, move, move assignment
@@ -179,15 +179,6 @@ public:
void mark_as_advertised() { _advertised = true; }
/**
* Try to change the size of the queue. This can only be done as long as nobody published yet.
* This is the case, for example when orb_subscribe was called before an orb_advertise.
* The queue size can only be increased.
* @param queue_size new size of the queue
* @return PX4_OK if queue size successfully set
*/
int update_queue_size(unsigned int queue_size);
/**
* Print statistics
* @param max_topic_length max topic name length for printing
@@ -195,7 +186,7 @@ public:
*/
bool print_statistics(int max_topic_length);
uint8_t get_queue_size() const { return _queue_size; }
uint8_t get_queue_size() const { return _meta->o_queue; }
int8_t subscriber_count() const { return _subscriber_count; }
@@ -234,7 +225,7 @@ public:
bool copy(void *dst, unsigned &generation)
{
if ((dst != nullptr) && (_data != nullptr)) {
if (_queue_size == 1) {
if (_meta->o_queue == 1) {
ATOMIC_ENTER;
memcpy(dst, _data, _meta->o_size);
generation = _generation.load();
@@ -253,12 +244,12 @@ public:
}
// Compatible with normal and overflow conditions
if (!is_in_range(current_generation - _queue_size, generation, current_generation - 1)) {
if (!is_in_range(current_generation - _meta->o_queue, generation, current_generation - 1)) {
// Reader is too far behind: some messages are lost
generation = current_generation - _queue_size;
generation = current_generation - _meta->o_queue;
}
memcpy(dst, _data + (_meta->o_size * (generation % _queue_size)), _meta->o_size);
memcpy(dst, _data + (_meta->o_size * (generation % _meta->o_queue)), _meta->o_size);
ATOMIC_LEAVE;
++generation;
@@ -295,7 +286,7 @@ private:
const uint8_t _instance; /**< orb multi instance identifier */
bool _advertised{false}; /**< has ever been advertised (not necessarily published data yet) */
uint8_t _queue_size; /**< maximum number of elements in the queue */
int8_t _subscriber_count{0};