Skip to content

Commit

Permalink
plz be below 25 cmon
Browse files Browse the repository at this point in the history
  • Loading branch information
misha7b committed Jun 8, 2024
1 parent 0809cc4 commit dd02c5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/navigation/control/navigator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,19 @@ bool Navigator::subscribeAndCheck(core::MqttTopic topic)
return true;
}

bool Navigator::subscribeToTopics()
{
return subscribeAndCheck(core::MqttTopic::kKeyence)
&& subscribeAndCheck(core::MqttTopic::kOpticalFlow)
&& subscribeAndCheck(core::MqttTopic::kAccelerometer);
}

void Navigator::run()
{
publishStart();
// Subscribe to all required topics

if (!subscribeAndCheck(core::MqttTopic::kKeyence)
|| !subscribeAndCheck(core::MqttTopic::kOpticalFlow)
|| !subscribeAndCheck(core::MqttTopic::kAccelerometer)) {
return;
}
if (!subscribeToTopics()) { return; }

while (true) {
bool sensor_data_received = false;
Expand Down
5 changes: 5 additions & 0 deletions lib/navigation/control/navigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ class Navigator : public INavigator {
*/
bool subscribeAndCheck(core::MqttTopic topic);

/**
* @brief Subscribes to all necessary topics
*/
bool subscribeToTopics();

private:
core::ILogger &logger_;
const core::ITimeSource &time_;
Expand Down

0 comments on commit dd02c5f

Please sign in to comment.