mirror of
https://github.com/BotChain-Robots/control.git
synced 2026-07-08 13:47:21 +02:00
Bugfixes
This commit is contained in:
@@ -61,7 +61,7 @@ class Module {
|
|||||||
uint8_t m_device_id;
|
uint8_t m_device_id;
|
||||||
ModuleType m_module_type;
|
ModuleType m_module_type;
|
||||||
Messaging::ConnectionType m_connection_type;
|
Messaging::ConnectionType m_connection_type;
|
||||||
uint8_t m_leader;
|
std::atomic<uint8_t> m_leader{0};
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_last_updated;
|
std::chrono::time_point<std::chrono::system_clock> m_last_updated;
|
||||||
std::vector<neighbour> m_neighbours;
|
std::vector<neighbour> m_neighbours;
|
||||||
std::shared_ptr<MessagingInterface> m_messaging_interface;
|
std::shared_ptr<MessagingInterface> m_messaging_interface;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class RobotController {
|
|||||||
std::thread m_configuration_loop;
|
std::thread m_configuration_loop;
|
||||||
std::thread m_sensor_loop;
|
std::thread m_sensor_loop;
|
||||||
std::thread m_expiry_looop;
|
std::thread m_expiry_looop;
|
||||||
uint8_t m_selected_leader = 0;
|
std::atomic<uint8_t> m_selected_leader{0};
|
||||||
|
|
||||||
void metadata_loop();
|
void metadata_loop();
|
||||||
void transmit_loop();
|
void transmit_loop();
|
||||||
|
|||||||
@@ -170,7 +170,9 @@ LIB_API bool remote_call_c(uint8_t function_tag, uint8_t module, const uint8_t *
|
|||||||
}
|
}
|
||||||
|
|
||||||
LIB_API const uint8_t *get_leaders(int *length) {
|
LIB_API const uint8_t *get_leaders(int *length) {
|
||||||
static const auto leaders = robot_controller->get_leaders();
|
static std::vector<uint8_t> leaders;
|
||||||
|
leaders = robot_controller->get_leaders();
|
||||||
*length = leaders.size();
|
*length = leaders.size();
|
||||||
|
spdlog::info("Returning {} leaders", *length);
|
||||||
return leaders.data();
|
return leaders.data();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ std::vector<Flatbuffers::ModuleInstance> RobotController::getModuleList() {
|
|||||||
std::vector<Flatbuffers::ModuleInstance> out;
|
std::vector<Flatbuffers::ModuleInstance> out;
|
||||||
std::shared_lock lock(m_module_lock);
|
std::shared_lock lock(m_module_lock);
|
||||||
for (auto const &[key, value] : m_id_to_module) {
|
for (auto const &[key, value] : m_id_to_module) {
|
||||||
out.push_back({key, value->get_type(), value->get_leader()});
|
out.push_back({key, value->get_type(), 0, value->get_leader()});
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@@ -305,6 +305,7 @@ std::vector<uint8_t> RobotController::get_leaders() {
|
|||||||
std::shared_lock lock(m_module_lock);
|
std::shared_lock lock(m_module_lock);
|
||||||
std::unordered_set<uint8_t> out{};
|
std::unordered_set<uint8_t> out{};
|
||||||
|
|
||||||
|
spdlog::info("number of modules {}", m_id_to_module.size());
|
||||||
for (const auto m : map_to_values(m_id_to_module)) {
|
for (const auto m : map_to_values(m_id_to_module)) {
|
||||||
out.insert(m->get_leader());
|
out.insert(m->get_leader());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user