diff --git a/app/rpi/common/include/behaviour_tree/BehaviourTreeHandler.hpp b/app/rpi/common/include/behaviour_tree/BehaviourTreeHandler.hpp index a229988b..15699708 100644 --- a/app/rpi/common/include/behaviour_tree/BehaviourTreeHandler.hpp +++ b/app/rpi/common/include/behaviour_tree/BehaviourTreeHandler.hpp @@ -124,7 +124,7 @@ namespace behaviour_tree { const std::chrono::time_point now = std::chrono::steady_clock::now(); // TODO: - if (this->last_connected >= this->car_system->getConfiguration()->behaviour_tree_update_ms_interval) { + if (now - this->last_connected >= this->car_system->getConfiguration()->behaviour_tree_update_ms_interval) { this->context->update(this->tick_count); this->tick_count++; this->last_connected = now; diff --git a/app/rpi/daemon/src/main.cpp b/app/rpi/daemon/src/main.cpp index cdd3f360..7b4d6e47 100644 --- a/app/rpi/daemon/src/main.cpp +++ b/app/rpi/daemon/src/main.cpp @@ -65,6 +65,8 @@ class rpi_daemon : public daemon const std::string lidar_port = reader.GetString("RaspberryPi", "lidar_port", default_lidar_port); dlog::info(fmt::format("Using lidar port: {}", lidar_port)); configuration->lidar_port = lidar_port; + + configuration->behaviour_tree_update_ms_interval = std::chrono::milliseconds(reader.GetInteger("RaspberryPi", "behaviour_tree_update_ms_interval", 100)); this->any_configuration_empty = host.empty(); if (this->any_configuration_empty) diff --git a/app/rpi/tui/src/car/configuration/JsonConfiguration.cxx b/app/rpi/tui/src/car/configuration/JsonConfiguration.cxx index 70f6640e..48d9c8c4 100644 --- a/app/rpi/tui/src/car/configuration/JsonConfiguration.cxx +++ b/app/rpi/tui/src/car/configuration/JsonConfiguration.cxx @@ -68,7 +68,7 @@ namespace car::configuration configuration.lidar_port = "COM3"; #endif } - configuration.behaviour_tree_update_ms_interval = config_json["behaviour_tree_update_ms_interval"].GetInt(); + configuration.behaviour_tree_update_ms_interval = std::chrono::milliseconds(config_json["behaviour_tree_update_ms_interval"].GetInt()); return configuration; } catch (const std::exception &e)