Skip to content

Commit

Permalink
led_config_file -> animations_config_path
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Sep 30, 2024
1 parent 4174526 commit 4c459d4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Launch arguments are largely common to both simulation and physical robot. Howev
| --- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 🖥️ | `add_wheel_joints` | Flag enabling joint_state_publisher to publish information about the wheel position. Should be false when there is a controller that sends this information. <br/> ***bool:*** `False` |
| 🖥️ | `add_world_transform` | Adds a world frame that connects the tf trees of individual robots (useful when running multiple robots). <br/> ***bool:*** `False` |
| 🤖🖥️ | `animations_config_path` | Path to a YAML file with a description of led configuration. This file includes definition of robot panels, virtual segments and default animations. <br/> ***string:*** [`led_config.yaml`](./panther_lights/config/led_config.yaml) |
| 🖥️ | `battery_config_path` | Path to the Ignition LinearBatteryPlugin configuration file. This configuration is intended for use in simulations only. <br/> ***string:*** `None` |
| 🤖🖥️ | `components_config_path` | Additional components configuration file. Components described in this file are dynamically included in Panther's urdf. Panther options are described in [the manual](https://husarion.com/manuals/panther/panther-options). <br/> ***string:*** [`components.yaml`](./panther_description/config/components.yaml) |
| 🤖🖥️ | `controller_config_path` | Path to controller configuration file. A path to custom configuration can be specified here. <br/> ***string:*** [`{wheel_type}_controller.yaml`](./panther_controller/config/) |
Expand All @@ -98,7 +99,6 @@ Launch arguments are largely common to both simulation and physical robot. Howev
| 🖥️ | `gz_log_level` | Adjust the level of console output. <br/> ***int:*** `1` (choices: `0`, `1`, `2`, `3`, `4`) |
| 🖥️ | `gz_world` | Absolute path to SDF world file. <br/> ***string:*** [`husarion_world.sdf`](https://github.com/husarion/husarion_gz_worlds/blob/main/worlds/husarion_world.sdf) |
| 🤖 | `launch_nmea_gps` | Whether to launch the NMEA NavSat driver node. Advisable when the robot is equipped with the [ANT02](https://husarion.com/manuals/panther/panther-options/#ant02---wi-fi--lte--gps). <br/> ***bool:*** `False` |
| 🤖🖥️ | `led_config_file` | Path to a YAML file with a description of led configuration. This file includes definition of robot panels, virtual segments and default animations. <br/> ***string:*** [`led_config.yaml`](./panther_lights/config/led_config.yaml) |
| 🤖🖥️ | `lights_bt_project_path` | Path to BehaviorTree project file, responsible for lights management. <br/> ***string:*** [`PantherLightsBT.btproj`](./panther_manager/behavior_trees/PantherLightsBT.btproj) |
| 🤖🖥️ | `localization_config_path` | Specify the path to the localization configuration file. <br/> ***string:*** [`relative_localization.yaml`](./panther_localization/config/relative_localization.yaml) |
| 🤖🖥️ | `localization_mode` | Specifies the localization mode: <br/>- 'relative' `odometry/filtered` data is relative to the initial position and orientation. <br/>- 'enu' `odometry/filtered` data is relative to initial position and ENU (East North Up) orientation. <br/> ***string:*** `relative` (choices: `relative`, `enu`) |
Expand Down
2 changes: 1 addition & 1 deletion panther_lights/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ This node is of type rclcpp_components is responsible for processing animations

#### Parameters

- `~animations_config_path` [*string*, default: **$(find panther_lights)/panther_lights/config/led_config.yaml**]: Path to a YAML file with a description of led configuration. This file includes definition of robot panels, virtual segments and default animations.
- `~controller_frequency` [*float*, default: **50.0**]: Frequency [Hz] at which the lights controller node will process animations.
- `~led_config_file` [*string*, default: **$(find panther_lights)/panther_lights/config/led_config.yaml**]: Path to a YAML file with a description of led configuration. This file includes definition of robot panels, virtual segments and default animations.
- `~user_led_animations_path` [*string*, default: **None**]: Path to a YAML file with a description of the user defined animations.

### LightsDriverNode
Expand Down
10 changes: 5 additions & 5 deletions panther_lights/launch/lights.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@


def generate_launch_description():
led_config_file = LaunchConfiguration("led_config_file")
declare_led_config_file_arg = DeclareLaunchArgument(
"led_config_file",
animations_config_path = LaunchConfiguration("animations_config_path")
declare_animations_config_path_arg = DeclareLaunchArgument(
"animations_config_path",
default_value=PathJoinSubstitution(
[FindPackageShare("panther_lights"), "config", "led_config.yaml"]
),
Expand Down Expand Up @@ -82,7 +82,7 @@ def generate_launch_description():
name="lights_controller",
namespace=namespace,
parameters=[
{"led_config_file": led_config_file},
{"animations_config_path": animations_config_path},
{"user_led_animations_path": user_led_animations_path},
],
extra_arguments=[
Expand All @@ -95,7 +95,7 @@ def generate_launch_description():
)

actions = [
declare_led_config_file_arg,
declare_animations_config_path_arg,
declare_namespace_arg,
declare_use_sim_arg,
declare_user_led_animations_path_arg,
Expand Down
6 changes: 3 additions & 3 deletions panther_lights/src/lights_controller_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ LightsControllerNode::LightsControllerNode(const rclcpp::NodeOptions & options)

using namespace std::placeholders;

this->declare_parameter<std::string>("led_config_file");
this->declare_parameter<std::string>("animations_config_path");
this->declare_parameter<std::string>("user_led_animations_path", "");
this->declare_parameter<float>("controller_freq", 50.0);

const auto led_config_file = this->get_parameter("led_config_file").as_string();
const auto animations_config_path = this->get_parameter("animations_config_path").as_string();
const auto user_led_animations_path = this->get_parameter("user_led_animations_path").as_string();
const float controller_freq = this->get_parameter("controller_freq").as_double();

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

InitializeLEDPanels(led_config_desc["panels"]);
InitializeLEDSegments(led_config_desc["segments"], controller_freq);
Expand Down
4 changes: 2 additions & 2 deletions panther_lights/test/integration/panther_lights.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@

def generate_test_description():

led_config_file = (
animations_config_path = (
PathJoinSubstitution([FindPackageShare("panther_lights"), "config", "led_config.yaml"]),
)

lights_controller_node = Node(
package="panther_lights",
executable="lights_controller_node",
parameters=[{"led_config_file": led_config_file}],
parameters=[{"animations_config_path": animations_config_path}],
)

lights_driver_node = Node(
Expand Down
13 changes: 8 additions & 5 deletions panther_lights/test/unit/test_lights_controller_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,29 @@ class TestLightsControllerNode : public testing::Test
static constexpr char kTestSegmentName[] = "test";
static constexpr char kTestSegmentLedRange[] = "0-9";

std::filesystem::path led_config_file_;
std::filesystem::path animations_config_path_;
std::shared_ptr<ControllerNodeWrapper> lights_controller_node_;
};

TestLightsControllerNode::TestLightsControllerNode()
{
led_config_file_ = testing::TempDir() + "/led_config.yaml";
animations_config_path_ = testing::TempDir() + "/led_config.yaml";

CreateLEDConfig(led_config_file_);
CreateLEDConfig(animations_config_path_);

std::vector<rclcpp::Parameter> params;
params.push_back(rclcpp::Parameter("led_config_file", led_config_file_));
params.push_back(rclcpp::Parameter("animations_config_path", animations_config_path_));

rclcpp::NodeOptions options;
options.parameter_overrides(params);

lights_controller_node_ = std::make_shared<ControllerNodeWrapper>(options);
}

TestLightsControllerNode::~TestLightsControllerNode() { std::filesystem::remove(led_config_file_); }
TestLightsControllerNode::~TestLightsControllerNode()
{
std::filesystem::remove(animations_config_path_);
}

void TestLightsControllerNode::CreateLEDConfig(const std::filesystem::path file_path)
{
Expand Down

0 comments on commit 4c459d4

Please sign in to comment.