Skip to content

Commit

Permalink
Unify arguments and config names
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Sep 24, 2024
1 parent 08ec819 commit 4174526
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 25 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
devel/
logs/
build/
log/
install/
bin/
lib/
msg_gen/
Expand All @@ -13,8 +13,6 @@ msg/*Feedback.msg
msg/*Goal.msg
msg/*Result.msg
msg/_*.py
build_isolated/
devel_isolated/

# Generated by dynamic reconfigure
*.cfgc
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Simulation:
ros2 launch panther_gazebo simulation.launch.py
```

> [!IMPORTANT]
> You can change spawning robot in simulation, by adding `robot_model:={robot_model}` argument.
### Launch Arguments

Launch arguments are largely common to both simulation and physical robot. However, there is a group of arguments that apply only to hardware or only to the simulator. Below is a legend to the tables with all launch arguments.
Expand Down Expand Up @@ -106,7 +109,7 @@ Launch arguments are largely common to both simulation and physical robot. Howev
| 🤖🖥️ | `shutdown_hosts_config_path` | Path to file with list of hosts to request shutdown. <br/> ***string:*** [`shutdown_hosts_config.yaml`](./panther_manager/config/shutdown_hosts_config.yaml) |
| 🤖🖥️ | `use_ekf` | Enable or disable EKF. <br/> ***bool:*** `True` |
| 🤖🖥️ | `use_sim` | Whether simulation is used. <br/> ***bool:*** `False` |
| 🤖🖥️ | `user_led_animations_file` | Path to a YAML file with a description of the user-defined animations. <br/> ***string:*** `''` |
| 🤖🖥️ | `user_led_animations_path` | Path to a YAML file with a description of the user-defined animations. <br/> ***string:*** `''` |
| 🤖🖥️ | `wheel_config_path` | Path to wheel configuration file. <br/> ***string:*** [`{wheel_type}.yaml`](./panther_description/config) |
| 🤖🖥️ | `wheel_type` | Specify the wheel type. If the selected wheel type is not 'custom', the wheel_config_path and controller_config_path arguments will be automatically adjusted and can be omitted. <br/> ***string:*** `WH01` (for Panther), `WH05` (for Lynx) (choices: `WH01`, `WH02`, `WH04`, `WH05`, `custom`) |
| 🖥️ | `x` | Initial robot position in the global 'x' axis. <br/> ***float:*** `0.0` |
Expand Down
2 changes: 1 addition & 1 deletion panther_gazebo/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To obtain GPS data in Ignition, follow these steps:

## Linear Battery Plugin

It is possible to simulate the battery operation of the Panther robot. By default, this feature is disabled, but you can enable it by setting the `simulate_discharging` parameter to `true` in the `battery_plugin_config.yaml` file or in the file pointed to by the `battery_config_path` parameter. Below, you will find the plugin parameters that enable battery simulation.
It is possible to simulate the battery operation of the Panther robot. By default, this feature is disabled, but you can enable it by setting the `simulate_discharging` parameter to `true` in the `battery_plugin.yaml` file or in the file pointed to by the `battery_config_path` parameter. Below, you will find the plugin parameters that enable battery simulation.

- `simulate_discharging` [*bool*, default: **false**]: Enables battery simulation. If set to `true`, the battery will discharge **at a constant rate** (regardless of joint torque), and if it depletes completely, the robot will stop moving. When set to `false`, the battery will not discharge, but the battery status information will still be published on the `battery/battery_status` topic.
- `initial_charge_percentage` [*float*, default: **70.0**]: Sets the initial charge percentage of the battery.
Expand Down
2 changes: 1 addition & 1 deletion panther_gazebo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The package contains a launch file and source files used to run the robot simula

## Configuration Files

- [`battery_plugin_config.yaml`](./config/battery_plugin_config.yaml): Simulated LinearBatteryPlugin configuration.
- [`battery_plugin.yaml`](./config/battery_plugin.yaml): Simulated LinearBatteryPlugin configuration.
- [`gz_bridge.yaml`](./config/gz_bridge.yaml): Specify data to exchange between ROS and Gazebo simulation.
- [`teleop_with_estop.config`](./config/teleop_with_estop.config): Gazebo layout configuration file, which adds E-Stop and Teleop widgets.

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion panther_gazebo/launch/simulate_robot.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def generate_launch_description():
"This configuration is intended for use in simulations only."
),
default_value=PathJoinSubstitution(
[FindPackageShare("panther_gazebo"), "config", "battery_plugin_config.yaml"]
[FindPackageShare("panther_gazebo"), "config", "battery_plugin.yaml"]
),
)

Expand Down
2 changes: 1 addition & 1 deletion panther_lights/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This node is of type rclcpp_components is responsible for processing 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_file` [*string*, default: **None**]: Path to a YAML file with a description of the user defined animations.
- `~user_led_animations_path` [*string*, default: **None**]: Path to a YAML file with a description of the user defined animations.

### LightsDriverNode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class LightsControllerNode : public rclcpp::Node
/**
* @brief Adds animations to an unordered map with animations
*
* @param user_led_animations_file path to YAML file with user animations description
* @param user_led_animations_path path to YAML file with user animations description
*/
void LoadUserAnimations(const std::string & user_led_animations_file);
void LoadUserAnimations(const std::string & user_led_animations_path);

/**
* @brief Adds animation to an unordered map with animations
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 @@ -52,9 +52,9 @@ def generate_launch_description():
description="Whether simulation is used",
)

user_led_animations_file = LaunchConfiguration("user_led_animations_file")
declare_user_led_animations_file_arg = DeclareLaunchArgument(
"user_led_animations_file",
user_led_animations_path = LaunchConfiguration("user_led_animations_path")
declare_user_led_animations_path_arg = DeclareLaunchArgument(
"user_led_animations_path",
default_value="",
description="Path to a YAML file with a description of the user defined animations.",
)
Expand Down Expand Up @@ -83,7 +83,7 @@ def generate_launch_description():
namespace=namespace,
parameters=[
{"led_config_file": led_config_file},
{"user_led_animations_file": user_led_animations_file},
{"user_led_animations_path": user_led_animations_path},
],
extra_arguments=[
{"use_intra_process_comms": True},
Expand All @@ -98,7 +98,7 @@ def generate_launch_description():
declare_led_config_file_arg,
declare_namespace_arg,
declare_use_sim_arg,
declare_user_led_animations_file_arg,
declare_user_led_animations_path_arg,
lights_container,
]

Expand Down
12 changes: 6 additions & 6 deletions panther_lights/src/lights_controller_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ LightsControllerNode::LightsControllerNode(const rclcpp::NodeOptions & options)
using namespace std::placeholders;

this->declare_parameter<std::string>("led_config_file");
this->declare_parameter<std::string>("user_led_animations_file", "");
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 user_led_animations_file = this->get_parameter("user_led_animations_file").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);
Expand All @@ -63,8 +63,8 @@ LightsControllerNode::LightsControllerNode(const rclcpp::NodeOptions & options)
InitializeLEDSegmentsMap(led_config_desc["segments_map"]);
LoadDefaultAnimations(led_config_desc["led_animations"]);

if (user_led_animations_file != "") {
LoadUserAnimations(user_led_animations_file);
if (user_led_animations_path != "") {
LoadUserAnimations(user_led_animations_path);
}

segment_converter_ = std::make_shared<SegmentConverter>();
Expand Down Expand Up @@ -159,12 +159,12 @@ void LightsControllerNode::LoadDefaultAnimations(const YAML::Node & animations_d
RCLCPP_INFO(this->get_logger(), "Loaded default animations.");
}

void LightsControllerNode::LoadUserAnimations(const std::string & user_led_animations_file)
void LightsControllerNode::LoadUserAnimations(const std::string & user_led_animations_path)
{
RCLCPP_DEBUG(this->get_logger(), "Loading user's animations.");

try {
YAML::Node user_led_animations = YAML::LoadFile(user_led_animations_file);
YAML::Node user_led_animations = YAML::LoadFile(user_led_animations_path);
auto user_animations = panther_utils::GetYAMLKeyValue<std::vector<YAML::Node>>(
user_led_animations, "user_animations");

Expand Down
2 changes: 1 addition & 1 deletion panther_manager/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
For more information regarding shutdown behavior, refer to `ShutdownSingleHost` BT node in the [Actions](#actions) section. An example of a shutdown hosts YAML file can be found below.

``` yaml
# My shutdown_hosts_config.yaml
# My shutdown_hosts.yaml
hosts:
# Intel NUC, user computer
- ip: 10.15.20.3
Expand Down
2 changes: 1 addition & 1 deletion panther_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This package contains:
- [`shutdown.xml`](./behavior_trees/shutdown.xml): BehaviorTree for initiating shutdown procedures.
- [`lights_manager.yaml`](./config/lights_manager.yaml): Contains parameters for the `lights_manager` node.
- [`safety_manager.yaml`](./config/safety_manager.yaml): Contains parameters for the `safety_manager` node.
- [`shutdown_hosts_config.yaml`](./config/shutdown_hosts_config.yaml): List with all hosts to request shutdown.
- [`shutdown_hosts.yaml`](./config/shutdown_hosts.yaml): List with all hosts to request shutdown.

## ROS Nodes

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion panther_manager/launch/manager.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def generate_launch_description():
[
FindPackageShare("panther_manager"),
"config",
"shutdown_hosts_config.yaml",
"shutdown_hosts.yaml",
]
),
description="Path to file with list of hosts to request shutdown.",
Expand Down

0 comments on commit 4174526

Please sign in to comment.