mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 07:23:33 +08:00
local_position_estimator: move to WQ and delete unused SubscriptionPollable
This commit is contained in:
@@ -42,8 +42,6 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <uORB/SubscriptionPollable.hpp>
|
||||
|
||||
namespace control
|
||||
{
|
||||
|
||||
@@ -99,24 +97,6 @@ void Block::updateParams()
|
||||
updateParamsSubclass();
|
||||
}
|
||||
|
||||
void Block::updateSubscriptions()
|
||||
{
|
||||
uORB::SubscriptionPollableNode *sub = getSubscriptions().getHead();
|
||||
int count = 0;
|
||||
|
||||
while (sub != nullptr) {
|
||||
if (count++ > maxSubscriptionsPerBlock) {
|
||||
char name[blockNameLengthMax];
|
||||
getName(name, blockNameLengthMax);
|
||||
PX4_ERR("exceeded max subscriptions for block: %s", name);
|
||||
break;
|
||||
}
|
||||
|
||||
sub->update();
|
||||
sub = sub->getSibling();
|
||||
}
|
||||
}
|
||||
|
||||
void SuperBlock::setDt(float dt)
|
||||
{
|
||||
Block::setDt(dt);
|
||||
@@ -154,25 +134,6 @@ void SuperBlock::updateChildParams()
|
||||
}
|
||||
}
|
||||
|
||||
void SuperBlock::updateChildSubscriptions()
|
||||
{
|
||||
Block *child = getChildren().getHead();
|
||||
int count = 0;
|
||||
|
||||
while (child != nullptr) {
|
||||
if (count++ > maxChildrenPerBlock) {
|
||||
char name[blockNameLengthMax];
|
||||
getName(name, blockNameLengthMax);
|
||||
PX4_ERR("exceeded max children for block: %s", name);
|
||||
break;
|
||||
}
|
||||
|
||||
child->updateSubscriptions();
|
||||
child = child->getSibling();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace control
|
||||
|
||||
template class List<uORB::SubscriptionPollableNode *>;
|
||||
template class List<control::BlockParamBase *>;
|
||||
|
||||
@@ -40,15 +40,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <containers/List.hpp>
|
||||
#include <uORB/SubscriptionPollable.hpp>
|
||||
#include <controllib/block/BlockParam.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace control
|
||||
{
|
||||
|
||||
static constexpr uint8_t maxChildrenPerBlock = 100;
|
||||
static constexpr uint8_t maxParamsPerBlock = 110;
|
||||
static constexpr uint8_t maxSubscriptionsPerBlock = 100;
|
||||
static constexpr uint8_t blockNameLengthMax = 40;
|
||||
|
||||
// forward declaration
|
||||
@@ -74,7 +73,6 @@ public:
|
||||
void getName(char *name, size_t n);
|
||||
|
||||
virtual void updateParams();
|
||||
virtual void updateSubscriptions();
|
||||
|
||||
virtual void setDt(float dt) { _dt = dt; }
|
||||
float getDt() { return _dt; }
|
||||
@@ -84,14 +82,12 @@ protected:
|
||||
virtual void updateParamsSubclass() {}
|
||||
|
||||
SuperBlock *getParent() { return _parent; }
|
||||
List<uORB::SubscriptionPollableNode *> &getSubscriptions() { return _subscriptions; }
|
||||
List<BlockParamBase *> &getParams() { return _params; }
|
||||
|
||||
const char *_name;
|
||||
SuperBlock *_parent;
|
||||
float _dt{0.0f};
|
||||
|
||||
List<uORB::SubscriptionPollableNode *> _subscriptions;
|
||||
List<BlockParamBase *> _params;
|
||||
};
|
||||
|
||||
@@ -119,17 +115,9 @@ public:
|
||||
if (getChildren().getHead() != nullptr) { updateChildParams(); }
|
||||
}
|
||||
|
||||
void updateSubscriptions() override
|
||||
{
|
||||
Block::updateSubscriptions();
|
||||
|
||||
if (getChildren().getHead() != nullptr) { updateChildSubscriptions(); }
|
||||
}
|
||||
|
||||
protected:
|
||||
List<Block *> &getChildren() { return _children; }
|
||||
void updateChildParams();
|
||||
void updateChildSubscriptions();
|
||||
|
||||
List<Block *> _children;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user