Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KmakD committed Dec 5, 2024
1 parent 450e189 commit b01865e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
4 changes: 3 additions & 1 deletion husarion_ugv_lights/config/user_animations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#
# For more examples and detailed documentation, please visit:
# https://github.com/husarion/panther_ros/blob/ros2/panther_lights/CONFIGURATION.md#defining-animations
#

user_animations: []

# Example including a simple custom animation:
#
# user_animations:
Expand Down
1 change: 0 additions & 1 deletion husarion_ugv_manager/src/lights_manager_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <string>
#include <vector>

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "behaviortree_ros2/ros_node_params.hpp"
#include "rclcpp/rclcpp.hpp"

Expand Down
3 changes: 1 addition & 2 deletions husarion_ugv_manager/src/safety_manager_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <utility>
#include <vector>

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "behaviortree_ros2/ros_node_params.hpp"
#include "rclcpp/rclcpp.hpp"

Expand Down Expand Up @@ -138,7 +137,7 @@ std::map<std::string, std::any> SafetyManagerNode::CreateSafetyInitialBlackboard
const double cpu_fan_off_temp = this->params_.cpu.temp.fan_off;
const double driver_fan_on_temp = this->params_.driver.temp.fan_on;
const double driver_fan_off_temp = this->params_.driver.temp.fan_off;
const double fan_turn_off_timeout = this->params_.fan_turn_off_timeout;
const float fan_turn_off_timeout = static_cast<float>(this->params_.fan_turn_off_timeout);

const std::map<std::string, std::any> safety_initial_bb = {
{"CPU_FAN_OFF_TEMP", cpu_fan_off_temp},
Expand Down
11 changes: 8 additions & 3 deletions husarion_ugv_manager/test/test_lights_behavior_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "gtest/gtest.h"

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "behaviortree_cpp/basic_types.h"
#include "rclcpp/rclcpp.hpp"

Expand Down Expand Up @@ -107,18 +108,22 @@ TestLightsBehaviorTree::TestLightsBehaviorTree()

std::vector<rclcpp::Parameter> TestLightsBehaviorTree::CreateTestParameters() const
{
const auto panther_manager_pkg_path =
ament_index_cpp::get_package_share_directory("husarion_ugv_manager");
const std::string bt_project_path = panther_manager_pkg_path + "/behavior_trees/LightsBT.btproj";

std::vector<std::string> plugin_libs;
plugin_libs.push_back("tick_after_timeout_bt_node");

std::vector<std::string> ros_plugin_libs;
ros_plugin_libs.push_back("call_set_led_animation_service_bt_node");

std::vector<rclcpp::Parameter> params;
params.push_back(rclcpp::Parameter("bt_project_path", bt_project_path));
params.push_back(rclcpp::Parameter("plugin_libs", plugin_libs));
params.push_back(rclcpp::Parameter("ros_plugin_libs", ros_plugin_libs));
params.push_back(rclcpp::Parameter("battery.animation_period.low", kLowBatteryAnimPeriod));
params.push_back(
rclcpp::Parameter("battery.animation_period.critical", kCriticalBatteryAnimPeriod));
params.push_back(rclcpp::Parameter("battery.anim_period.low", kLowBatteryAnimPeriod));
params.push_back(rclcpp::Parameter("battery.anim_period.critical", kCriticalBatteryAnimPeriod));

return params;
}
Expand Down
6 changes: 6 additions & 0 deletions husarion_ugv_manager/test/test_safety_behavior_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "gtest/gtest.h"

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "behaviortree_cpp/basic_types.h"
#include "rclcpp/rclcpp.hpp"

Expand Down Expand Up @@ -126,6 +127,10 @@ TestSafetyBehaviorTree::~TestSafetyBehaviorTree() { rclcpp::shutdown(); }

std::vector<rclcpp::Parameter> TestSafetyBehaviorTree::CreateTestParameters() const
{
const auto panther_manager_pkg_path =
ament_index_cpp::get_package_share_directory("husarion_ugv_manager");
const std::string bt_project_path = panther_manager_pkg_path + "/behavior_trees/SafetyBT.btproj";

std::vector<std::string> plugin_libs;
plugin_libs.push_back("tick_after_timeout_bt_node");
plugin_libs.push_back("shutdown_single_host_bt_node");
Expand All @@ -137,6 +142,7 @@ std::vector<rclcpp::Parameter> TestSafetyBehaviorTree::CreateTestParameters() co
ros_plugin_libs.push_back("call_trigger_service_bt_node");

std::vector<rclcpp::Parameter> params;
params.push_back(rclcpp::Parameter("bt_project_path", bt_project_path));
params.push_back(rclcpp::Parameter("plugin_libs", plugin_libs));
params.push_back(rclcpp::Parameter("ros_plugin_libs", ros_plugin_libs));
params.push_back(rclcpp::Parameter("fan_turn_off_timeout", kFanTurnOffTimeout));
Expand Down

0 comments on commit b01865e

Please sign in to comment.