Class ImageAnimation

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class ImageAnimation : public husarion_ugv_lights::Animation

Subclassed by husarion_ugv_lights::MovingImageAnimation

Public Functions

inline ImageAnimation()
inline ~ImageAnimation()
virtual void Initialize(const YAML::Node &animation_description, const std::size_t num_led, const float controller_frequency) override

Initialize and verify if animation was correctly defined.

Parameters:
  • animation_description – YAML description of animation

  • num_led – number of LEDs

  • controller_frequency – frequency at which animation will be updated

Throws:

std::out_of_range – or std::runtime_error if animation parameters defined in description are missing or are incorrect

Protected Functions

virtual std::vector<std::uint8_t> UpdateFrame() override

Abstract method that has to be implemented inside child class it should return RGBA animation frame with size equal to num_led_ * kRGBAColorLen.

std::filesystem::path ParseImagePath(const std::string &image_path) const

Process raw image path including extracting ros package shared directory path specified with ‘$(find ros_package)` syntax.

Parameters:

image_path – raw path to an image, it should be a global path or should contain ‘$(find ros_package)` syntax

Throws:

std::runtime_error – if provided image_path is invalid or file does not exists

Returns:

global path to an image file

gil::rgba8_image_t RGBAImageResize(const gil::rgba8_image_t &image, const std::size_t width, const std::size_t height) const
void RGBAImageConvertColor(gil::rgba8_image_t &image, const std::uint32_t color) const

This method converts RGB image to gray, normalizes gray image brightness and then applies provided color.

Parameters:
  • image – RGB image that will be converted

  • color – 24-bit RGB color

gil::gray_alpha8_image_t RGBAImageConvertToGrey(const gil::rgba8_image_t &image) const
void GreyImageNormalizeBrightness(gil::gray_alpha8_image_t &image) const

Protected Attributes

gil::rgba8_image_t image_