Class LedRgbDevice

Inheritance Relationships

Base Type

Class Documentation

class LedRgbDevice : public semantic_components::SemanticComponentCommandInterface<std_msgs::msg::ColorRGBA>

Public Functions

inline explicit LedRgbDevice(const std::string &name, const std::string &interface_r, const std::string &interface_g, const std::string &interface_b)

Constructor for a LED RGB device with interface names set based on device name. The constructor sets the command interface names to “<name>/interface_r”, “<name>/interface_g”, “<name>/interface_b”.

Parameters:
  • name[in] name of the LED device, used as a prefix for the command interface names

  • interface_r[in] name of the command interface for the red channel

  • interface_g[in] name of the command interface for the green channel

  • interface_b[in] name of the command interface for the blue channel

inline virtual bool set_values_from_message(const std_msgs::msg::ColorRGBA &message) override

Set LED states from ColorRGBA message.

Set the values of the LED RGB device from a ColorRGBA message.

Sets the values of the red, green, and blue channels from the message. If any of the values are out of the range [0, 1], the function fails and returns false.

Parameters:

message[in] ColorRGBA message

Returns:

true if all values were set, false otherwise