Skip to content

Commit

Permalink
local_position_estimator: move to WQ and delete unused SubscriptionPo…
Browse files Browse the repository at this point in the history
…llable
  • Loading branch information
dagar committed Nov 22, 2019
1 parent db69ff0 commit f271efa
Show file tree
Hide file tree
Showing 19 changed files with 345 additions and 789 deletions.
1 change: 0 additions & 1 deletion src/drivers/roboclaw/RoboClaw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#include <stdio.h>
#include <termios.h>
#include <lib/parameters/param.h>
#include <uORB/SubscriptionPollable.hpp>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/wheel_encoders.h>
#include <uORB/topics/actuator_armed.h>
Expand Down
39 changes: 0 additions & 39 deletions src/lib/controllib/block/Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

#include <cstring>

#include <uORB/SubscriptionPollable.hpp>

namespace control
{

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 *>;
14 changes: 1 addition & 13 deletions src/lib/controllib/block/Block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -74,7 +73,6 @@ class __EXPORT Block : public ListNode<Block *>
void getName(char *name, size_t n);

virtual void updateParams();
virtual void updateSubscriptions();

virtual void setDt(float dt) { _dt = dt; }
float getDt() { return _dt; }
Expand All @@ -84,14 +82,12 @@ class __EXPORT Block : public ListNode<Block *>
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;
};

Expand Down Expand Up @@ -119,17 +115,9 @@ class __EXPORT SuperBlock :
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;
};
Expand Down
Loading

0 comments on commit f271efa

Please sign in to comment.