Skip to content

Commit

Permalink
Parameter type casts and typo fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
miloszlagan committed Nov 19, 2024
1 parent be607f2 commit b0600b3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lights_controller:
animations_config_path:
type: string
default_value: ""
description: Path to a YAML file with a description of led configuration. This file includes definition of robot panels, virtual segments and default animations.
description: Path to a YAML file with a description of LED configuration. This file includes definition of robot panels, virtual segments and default animations.
validation: { not_empty<> }

controller_frequency:
Expand Down
2 changes: 1 addition & 1 deletion husarion_ugv_lights/src/lights_controller_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ LightsControllerNode::LightsControllerNode(const rclcpp::NodeOptions & options)

const auto animations_config_path = this->params_.animations_config_path;
const auto user_led_animations_path = this->params_.user_led_animations_path;
const float controller_freq = this->params_.controller_frequency;
const float controller_freq = static_cast<float>(this->params_.controller_frequency);

YAML::Node led_config_desc = YAML::LoadFile(animations_config_path);

Expand Down
17 changes: 8 additions & 9 deletions husarion_ugv_manager/config/lights_manager_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,50 @@ lights_manager:
critical:
type: double
default_value: 15.0
description: Time in seconds to wait before repeating animation, indicating a critical Battery state.
description: Time in seconds to wait before repeating animation, indicating a critical battery state.
validation: { gt<>: 0.0 }

low:
type: double
default_value: 30.0
description: Time in seconds to wait before repeating the animation, indicating a low Battery state.
description: Time in seconds to wait before repeating the animation, indicating a low battery state.
validation: { gt<>: 0.0 }

percent:
window_len:
type: int
default_value: 6
description: Moving average window length used to smooth out Battery percentage readings.
description: Moving average window length used to smooth out battery percentage readings.
validation: { gt<>: 0 }

threshold:
critical:
type: double
default_value: 0.1
description: If the Battery percentage drops below this value, an animation indicating a critical Battery state will start being displayed.
description: If the battery percentage drops below this value, an animation indicating a critical battery state will start being displayed.
validation: { bounds<>: [0.0, 1.0] }

low:
type: double
default_value: 0.4
description: If the Battery percentage drops below this value, the animation indicating a low Battery state will start being displayed.
description: If the battery percentage drops below this value, the animation indicating a low battery state will start being displayed.
validation: { bounds<>: [0.0, 1.0] }

bt_project_path:
type: string
default_value: ""
description: Path to a BehaviorTree project.
validation: { not_empty<> }

plugin_libs:
type: string_array
default_value: []
description: List with names of plugins that are used in the BT project.
description: A list with names of plugins that are used in the BehaviorTree project.

ros_communication_timeout:
availability:
type: double
default_value: 1.0
description: Timeout in seconds to wait for a service/action while initializing BT node.
description: Timeout in seconds to wait for a service/action while initializing a BehaviorTree node.
validation: { gt<>: 0.0 }

response:
Expand All @@ -66,7 +65,7 @@ lights_manager:
ros_plugin_libs:
type: string_array
default_value: []
description: List with names of ROS plugins that are used in a BT project.
description: A list with names of ROS plugins that are used in a BehaviorTree project.

timer_frequency:
type: double
Expand Down
9 changes: 4 additions & 5 deletions husarion_ugv_manager/config/safety_manager_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ safety_manager:
type: string
default_value: ""
description: Path to a BehaviorTree project.
validation: { not_empty<> }

cpu:
temp:
Expand Down Expand Up @@ -44,7 +43,7 @@ safety_manager:
fan_on:
type: double
default_value: 45.0
description: Temperature in degrees Celsius* of any drivers above which the fan is turned on.
description: Temperature in degrees Celsius of any drivers above which the fan is turned on.
validation: { bounds<>: [-20.0, 100.0] }

window_len:
Expand All @@ -62,13 +61,13 @@ safety_manager:
plugin_libs:
type: string_array
default_value: []
description: List with names of plugins that are used in the BT project.
description: A list with names of plugins that are used in the a BehaviorTree project.

ros_communication_timeout:
availability:
type: double
default_value: 1.0
description: Timeout seconds to wait for a service/action while initializing BT node.
description: Timeout seconds to wait for a service/action while initializing a BehaviorTree node.
validation: { gt<>: 0.0 }

response:
Expand All @@ -80,7 +79,7 @@ safety_manager:
ros_plugin_libs:
type: string_array
default_value: []
description: List with names of ROS plugins that are used in a BT project.
description: A list with names of ROS plugins that are used in a BehaviorTree project.

shutdown_hosts_path:
type: string
Expand Down
9 changes: 5 additions & 4 deletions husarion_ugv_manager/src/lights_manager_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ void LightsManagerNode::RegisterBehaviorTree()
std::map<std::string, std::any> LightsManagerNode::CreateLightsInitialBlackboard()
{
update_charging_anim_step_ = this->params_.battery.charging_anim_step;
const float critical_battery_anim_period = this->params_.battery.anim_period.critical;
const float critical_battery_threshold_percent = this->params_.battery.percent.threshold.critical;
const float low_battery_anim_period = this->params_.battery.anim_period.low;
const float low_battery_threshold_percent = this->params_.battery.percent.threshold.low;
const double critical_battery_anim_period = this->params_.battery.anim_period.critical;
const double critical_battery_threshold_percent =
this->params_.battery.percent.threshold.critical;
const double low_battery_anim_period = this->params_.battery.anim_period.low;
const double low_battery_threshold_percent = this->params_.battery.percent.threshold.low;

const std::string undefined_charging_anim_percent = "";
const int undefined_anim_id = -1;
Expand Down
12 changes: 6 additions & 6 deletions husarion_ugv_manager/src/safety_manager_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void SafetyManagerNode::Initialize()
// Timers
// -------------------------------

const float timer_freq = this->params_.timer_frequency;
const double timer_freq = this->params_.timer_frequency;
const auto timer_period_ms =
std::chrono::milliseconds(static_cast<unsigned>(1.0f / timer_freq * 1000));

Expand Down Expand Up @@ -134,11 +134,11 @@ void SafetyManagerNode::RegisterBehaviorTree()

std::map<std::string, std::any> SafetyManagerNode::CreateSafetyInitialBlackboard()
{
const float cpu_fan_on_temp = this->params_.cpu.temp.fan_on;
const float cpu_fan_off_temp = this->params_.cpu.temp.fan_off;
const float driver_fan_on_temp = this->params_.driver.temp.fan_on;
const float driver_fan_off_temp = this->params_.driver.temp.fan_off;
const float fan_turn_off_timeout = this->params_.fan_turn_off_timeout;
const double cpu_fan_on_temp = this->params_.cpu.temp.fan_on;
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 std::map<std::string, std::any> safety_initial_bb = {
{"CPU_FAN_OFF_TEMP", cpu_fan_off_temp},
Expand Down

0 comments on commit b0600b3

Please sign in to comment.