Class LightsControllerNode

Inheritance Relationships

Base Type

  • public rclcpp::Node

Class Documentation

class LightsControllerNode : public rclcpp::Node

Public Functions

LightsControllerNode(const rclcpp::NodeOptions &options = rclcpp::NodeOptions())
inline ~LightsControllerNode()

Protected Functions

void InitializeLEDPanels(const YAML::Node &panels_description)

Initializes LED panel based on YAML description. This LED panel is a representation of the real panel of the robot.

Parameters:

panels_description – YAML description of the panel, must contain ‘channel’ and ‘number_of_leds’ keys

Throws:

std::runtime_error – if initialization of the LED panel fails

void InitializeLEDSegments(const YAML::Node &segments_description, const float controller_freq)

Initializes LED segment based on YAML description. This LED segment is a representation of the abstract segment located on the panel of the robot.

Parameters:
  • segments_description – YAML description of the segment, must contain ‘name’, ‘channel’ and ‘led_range’ keys

  • controller_freq – Frequency at which animations will be processed

Throws:

std::runtime_error – if initialization of the LED segment fails

void InitializeLEDSegmentsMap(const YAML::Node &segments_map_description)

Initializes LED segments map based on YAML description. This assigns list with segments names to abstract names that can be used with animations to specify on which segments animation should be displayed.

Parameters:

segments_map_description – YAML description of the segments map

void LoadDefaultAnimations(const YAML::Node &animations_description)

Adds animations to an unordered map with animations.

Parameters:

animations_description – YAML description with list of animations

Throws:

std::runtime_error – if fails to load an animation or animation with given ID already exists in the map

void LoadUserAnimations(const std::string &user_led_animations_path)

Adds animations to an unordered map with animations.

Parameters:

user_led_animations_path – path to YAML file with user animations description

void LoadAnimation(const YAML::Node &animation_description)

Adds animation to an unordered map with animations.

Parameters:

animations_description – YAML description of the animation

Throws:

std::runtime_error – if fails to load an animation or animation with given ID already exists in the map

void UpdateAndPublishAnimation()

Updates all segments animations, converts then into panel frames and publishes panel frames on respective topics.

void AddAnimationToLayer(const std::size_t animation_id, const bool repeating, const std::string &param)

Add animation to LED animations queue.

Parameters:
  • animation_id – ID of the animations

  • repeating – Whether animations should repeat

  • param – Optional animation parameter

Throws:

std::runtime_error – if no animation with given ID exists

void SetLEDAnimation(const std::shared_ptr<LEDAnimation> &led_animation)

Add animations to LED segments based on LED animation.

Parameters:

led_animation – LED animation

Throws:

std::runtime_error – animation has invalid segment name or it fails to load