Class SegmentLayerInterface
Defined in File segment_layer_interface.hpp
Inheritance Relationships
Derived Types
public husarion_ugv_lights::SegmentLayer(Class SegmentLayer)public husarion_ugv_lights::SegmentQueueLayer(Class SegmentQueueLayer)
Class Documentation
-
class SegmentLayerInterface
Interface for LED segment layers.
Subclassed by husarion_ugv_lights::SegmentLayer, husarion_ugv_lights::SegmentQueueLayer
Public Functions
-
inline SegmentLayerInterface(const std::size_t num_led, const bool invert_led_order, const float controller_frequency)
Parses basic parameters of the LED segment.
- Parameters:
num_led – number of LEDs
invert_led_order – if true will invert the order of LEDs
controller_frequency – frequency at which animation will be updated.
- Throws:
std::runtime_error – if pluginlib fails to load animation plugin
-
inline virtual ~SegmentLayerInterface()
-
virtual void SetAnimation(const std::string &type, const YAML::Node &animation_description, const bool repeating, const std::string ¶m = "") = 0
Overwrite current animation.
- Parameters:
type – pluginlib animation type
animation_description – YAML description of the animation. Must contain ‘type’ key - pluginlib animation type
repeating – if true, will repeat animation for the panel
param – optional parameter to pass to animation when initializing
- Throws:
std::runtime_error – if failed to set animation
-
virtual void UpdateAnimation() = 0
Update animation frame.
- Throws:
std::runtime_error – if failed to update animation
-
inline bool IsAnimationFinished() const
Check if animation is finished. This does not return state of the default animation.
- Returns:
True if animation is finished, false otherwise
-
inline std::vector<std::uint8_t> GetAnimationFrame() const
Get current animation frame.
- Throws:
std::runtime_error – if segment animation is not defined
- Returns:
Current animation frame or default animation frame if it was defined and the main animation is finished
-
inline float GetAnimationProgress() const
Get current animation progress.
- Throws:
std::runtime_error – if segment animation is not defined
- Returns:
Current animation progress
-
inline void ResetAnimation()
Reset current animation.
- Throws:
std::runtime_error – if segment animation is not defined
-
inline bool HasAnimation() const
-
inline SegmentLayerInterface(const std::size_t num_led, const bool invert_led_order, const float controller_frequency)