Skip to content

Commit

Permalink
Add lynx lights launch, fixed tests, unify arguments and config names
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Sep 23, 2024
1 parent f831319 commit 6d0ba40
Show file tree
Hide file tree
Showing 31 changed files with 133 additions and 107 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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,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:*** [`{robot_model}_animations.yaml`](./panther_lights/config) |
| 🖥️ | `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 @@ -95,18 +96,17 @@ 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`) |
| 🤖🖥️ | `namespace` | Add namespace to all launched nodes. <br/> ***string:*** `env(ROBOT_NAMESPACE)` |
| 🤖🖥️ | `publish_robot_state` | Whether to publish the default Panther robot description. <br/> ***bool:*** `True` |
| 🖥️ | `robot_model` | Specify robot model type. <br/> ***string:*** `env(ROBOT_MODEL)` if not specified `panther` (choices: `lynx`, `panther`) |
| 🤖🖥️ | `safety_bt_project_path` | Path to BehaviorTree project file, responsible for safety and shutdown management. <br/> ***string:*** [`PantherSafetyBT.btproj`](./panther_manager/behavior_trees/PantherSafetyBT.btproj) |
| 🤖🖥️ | `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) |
| 🤖🖥️ | `shutdown_hosts_config_path` | Path to file with list of hosts to request shutdown. <br/> ***string:*** [`shutdown_hosts.yaml`](./panther_manager/config/shutdown_hosts.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
3 changes: 2 additions & 1 deletion panther_lights/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ install(

install(TARGETS panther_animation_plugins LIBRARY DESTINATION lib)

install(DIRECTORY animations config launch DESTINATION share/${PROJECT_NAME})
install(DIRECTORY animations config launch test
DESTINATION share/${PROJECT_NAME})

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
Expand Down
17 changes: 8 additions & 9 deletions panther_lights/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## LED Animations

Basic led configuration is loaded from [`led_config.yaml`](config/led_config.yaml) file. It includes definition of robot panels, virtual segments and default animations. Default animations can be found in the table below:
Basic led configuration is loaded from [`{robot_model}_animations.yaml`](config) file. It includes definition of robot panels, virtual segments and default animations. Default animations can be found in the table below:

| ID | NAME | PRIORITY | ANIMATION |
| :---: | ----------------- | :------: | -------------------------------------------------- |
Expand Down Expand Up @@ -121,7 +121,7 @@ user_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find my_custom_animation_package)/animations/custom_image.png
image: $(find custom_pkg)/animations/custom_image.png
duration: 3
repeat: 1

Expand All @@ -133,22 +133,21 @@ user_animations:
- type: panther_lights::ImageAnimation
segments: front
animation:
image: $(find panther_lights)/animations/triangle01_blue.png
image: $(find custom_pkg)/animations/front_custom_image.png
duration: 2
repeat: 2
- type: panther_lights::ImageAnimation
segments: rear
animation:
image: $(find panther_lights)/animations/triangle01_red.png
image: $(find custom_pkg)/animations/rear_custom_image.png
duration: 3
repeat: 1
```
> [!NOTE]
> ID numbers from 0 to 19 are reserved for system animations.
> [!NOTE]
> Priority **1** is reserved for crucial system animations. Users can only define animations with priority **2** and **3**.
> [!IMPORTANT]
>
> - ID numbers from 0 to 19 are reserved for system animations.
> - Priority **1** is reserved for crucial system animations. Users can only define animations with priority **2** and **3**.
Remember to modify launch command to use user animations:
Expand Down
7 changes: 4 additions & 3 deletions panther_lights/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This package contains:

## Configuration Files

- [`led_config.yaml`](./config/led_config.yaml): Defines and describes the appearance and parameters of the animations.
- [`{robot_model}_animations.yaml`](./config): Defines and describes the appearance and parameters of the animations for specific robot.
- [`{robot_model}_driver.yaml`](./config): Defines and describes specific hardware configuration for specific robot.

## ROS Nodes

Expand All @@ -29,9 +30,9 @@ This node is of type rclcpp_components is responsible for processing animations

#### Parameters

- `~animations_config_path` [*string*, default: **$(find panther_lights)/panther_lights/config/{robot_model}_animations.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_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 @@ -18,7 +18,6 @@ segments:
channel: 2
led_range: 21-11


segments_map:
all: [fl, fr, rl, rr]
front: [fl, fr]
Expand Down
5 changes: 5 additions & 0 deletions panther_lights/config/lynx_driver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**:
lights_driver:
ros__parameters:
channel_1_num_led: 22
channel_2_num_led: 22
5 changes: 5 additions & 0 deletions panther_lights/config/panther_driver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**:
lights_driver:
ros__parameters:
channel_1_num_led: 46
channel_2_num_led: 46
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
3 changes: 2 additions & 1 deletion panther_lights/include/panther_lights/lights_driver_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class LightsDriverNode : public rclcpp::Node
*/
void PanelThrottleWarnLog(const std::string panel_name, const std::string message);

int num_led_;
int channel_1_num_led_;
int channel_2_num_led_;
double frame_timeout_;
bool led_control_granted_;
bool led_control_pending_;
Expand Down
Loading

0 comments on commit 6d0ba40

Please sign in to comment.