Skip to content

Commit

Permalink
Fast light configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Sep 19, 2024
1 parent 6aaa52f commit da0175f
Show file tree
Hide file tree
Showing 18 changed files with 149 additions and 11 deletions.
4 changes: 2 additions & 2 deletions panther_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ def generate_launch_description():

actions = [
declare_battery_config_path_arg,
declare_robot_model_arg, # robot_model must be before wheel_type
declare_wheel_type_arg, # wheel_type must be before controller_config_path
declare_robot_model_arg, # robot_model is used by wheel_type
declare_wheel_type_arg, # wheel_type is used by controller_config_path
declare_components_config_path_arg,
declare_controller_config_path_arg,
declare_namespace_arg,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added panther_lights/animations/lynx/triangle01_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
123 changes: 123 additions & 0 deletions panther_lights/config/lynx_led_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
panels:
- channel: 1
number_of_leds: 22
- channel: 2
number_of_leds: 22

segments:
- name: fl
channel: 1
led_range: 0-10
- name: rl
channel: 1
led_range: 21-11
- name: fr
channel: 2
led_range: 0-10
- name: fl
channel: 2
led_range: 21-11


segments_map:
all: [fl, fr, rl, rr]
front: [fl, fr]
rear: [rl, rr]

led_animations:
- id: 0
name: E_STOP
priority: 3
animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/lynx/triangle01_red.png
duration: 2

- id: 1
name: READY
priority: 3
animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/lynx/triangle01_green.png
duration: 2

- id: 2
name: ERROR
priority: 1
animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/lynx/strip01_red.png
duration: 3
repeat: 2

- id: 3
name: MANUAL_ACTION
priority: 3
animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/lynx/triangle01_blue.png
duration: 3

- id: 4
name: AUTONOMOUS_ACTION
priority: 3
animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/lynx/triangle01_orange.png
duration: 3

- id: 5
name: GOAL_ACHIEVED
priority: 2
animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/lynx/strip01_purple.png
duration: 3
repeat: 2

- id: 6
name: LOW_BATTERY
priority: 2
animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/lynx/battery_low.png
duration: 2
repeat: 2

- id: 7
name: CRITICAL_BATTERY
priority: 2
animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/lynx/battery_critical.png
duration: 2
repeat: 2

# The BATTERY_STATE animation is no longer supported.
# Animation ID: 8 was intentionally omitted to keep numbering compatibility with ROS 1.

- id: 9
name: CHARGING_BATTERY
priority: 3
animations:
- type: panther_lights::ChargingAnimation
segments: all
animation:
duration: 3
repeat: 2
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ led_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/triangle01_red.png
image: $(find panther_lights)/animations/panther/triangle01_red.png
duration: 2

- id: 1
Expand All @@ -35,7 +35,7 @@ led_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/triangle01_green.png
image: $(find panther_lights)/animations/panther/triangle01_green.png
duration: 2

- id: 2
Expand All @@ -45,7 +45,7 @@ led_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/strip01_red.png
image: $(find panther_lights)/animations/panther/strip01_red.png
duration: 3
repeat: 2

Expand All @@ -56,7 +56,7 @@ led_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/triangle01_blue.png
image: $(find panther_lights)/animations/panther/triangle01_blue.png
duration: 3

- id: 4
Expand All @@ -66,7 +66,7 @@ led_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/triangle01_orange.png
image: $(find panther_lights)/animations/panther/triangle01_orange.png
duration: 3

- id: 5
Expand All @@ -76,7 +76,7 @@ led_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/strip01_purple.png
image: $(find panther_lights)/animations/panther/strip01_purple.png
duration: 3
repeat: 2

Expand All @@ -87,7 +87,7 @@ led_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/battery_low.png
image: $(find panther_lights)/animations/panther/battery_low.png
duration: 2
repeat: 2

Expand All @@ -98,7 +98,7 @@ led_animations:
- type: panther_lights::ImageAnimation
segments: all
animation:
image: $(find panther_lights)/animations/battery_critical.png
image: $(find panther_lights)/animations/panther/battery_critical.png
duration: 2
repeat: 2

Expand Down
17 changes: 16 additions & 1 deletion panther_lights/launch/lights.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, Shutdown
from launch.conditions import UnlessCondition
from launch.substitutions import (
EnvironmentVariable,
LaunchConfiguration,
PathJoinSubstitution,
PythonExpression,
)
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launch_ros.substitutions import FindPackageShare


def generate_launch_description():
robot_model = LaunchConfiguration("robot_model")
robot_led_config = PythonExpression(["'", robot_model, "_config.yaml'"])
led_config_file = LaunchConfiguration("led_config_file")
declare_led_config_file_arg = DeclareLaunchArgument(
"led_config_file",
default_value=PathJoinSubstitution(
[FindPackageShare("panther_lights"), "config", "led_config.yaml"]
[FindPackageShare("panther_lights"), "config", robot_led_config]
),
description="Path to a YAML file with a description of led configuration.",
)
Expand All @@ -45,6 +50,15 @@ def generate_launch_description():
description="Add namespace to all launched nodes.",
)

robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")
declare_robot_model_arg = DeclareLaunchArgument(
"robot_model",
default_value=robot_model_dict[robot_model_env],
description="Specify robot model",
choices=["lynx", "panther"],
)

use_sim = LaunchConfiguration("use_sim")
declare_use_sim_arg = DeclareLaunchArgument(
"use_sim",
Expand Down Expand Up @@ -95,6 +109,7 @@ def generate_launch_description():
)

actions = [
declare_robot_model_arg, # robot_model is used by led_config_file
declare_led_config_file_arg,
declare_namespace_arg,
declare_use_sim_arg,
Expand Down

0 comments on commit da0175f

Please sign in to comment.