Class Animation
Defined in File animation.hpp
Inheritance Relationships
Derived Type
public husarion_ugv_lights::ImageAnimation(Class ImageAnimation)
Class Documentation
-
class Animation
Subclassed by husarion_ugv_lights::ImageAnimation
Public Functions
-
inline virtual ~Animation()
-
inline virtual void Initialize(const YAML::Node &animation_description, const std::size_t num_led, const float controller_frequency)
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
-
inline void Update()
Update animation frame.
- Throws:
std::runtime_error – if UpdateFrame() method returns frame with invalid size
-
inline void Reset()
Reset animation, this will cause animation to start from the beginning if Update() method is invoked.
-
inline std::vector<std::uint8_t> GetFrame(const bool invert_frame_order = false)
Return animation frame.
- Parameters:
invert_frame_order – if true will return frame with inverted RGBA values order (last 4 values will become first etc.)
- Returns:
the newest animation frame, if animation is finished will return vector filled with 0
-
inline virtual void SetParam(const std::string&)
-
inline bool IsFinished() const
-
inline std::size_t GetNumberOfLeds() const
-
inline float GetProgress() const
Public Static Attributes
-
static constexpr std::size_t kRGBAColorLen = 4
Protected Functions
-
inline Animation()
-
virtual std::vector<std::uint8_t> UpdateFrame() = 0
Abstract method that has to be implemented inside child class it should return RGBA animation frame with size equal to num_led_ * kRGBAColorLen.
-
inline std::vector<std::uint8_t> InvertRGBAFrame(const std::vector<std::uint8_t> &frame) const
-
inline std::size_t GetAnimationLength() const
-
inline std::size_t GetAnimationIteration() const
Protected Attributes
-
std::vector<std::uint8_t> frame_
-
inline virtual ~Animation()