Skip to content

Commit

Permalink
Able to set behaviour_tree_update_ms_interval
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi-EEE committed Apr 16, 2024
1 parent b8c2f42 commit 702cb07
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace behaviour_tree
{
const std::chrono::time_point<std::chrono::steady_clock> 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;
Expand Down
2 changes: 2 additions & 0 deletions app/rpi/daemon/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/rpi/tui/src/car/configuration/JsonConfiguration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 702cb07

Please sign in to comment.