Class LightsDriverNode

Inheritance Relationships

Base Type

  • public rclcpp::Node

Class Documentation

class LightsDriverNode : public rclcpp::Node

Class for controlling APA102 LEDs based on a ROS Image topic.

Public Functions

LightsDriverNode(const rclcpp::NodeOptions &options = rclcpp::NodeOptions())
LightsDriverNode(APA102Interface::SharedPtr channel_1, APA102Interface::SharedPtr channel_2, const rclcpp::NodeOptions &options = rclcpp::NodeOptions())

Protected Functions

void ClearLEDs()

Clears all LEDs on both channels.

void ToggleLEDControlCB(rclcpp::Client<SetBoolSrv>::SharedFutureWithRequest future)

Callback to execute when service invoked to toggle LED control returns response.

Parameters:

future – Future object with request and response of the service call.

void FrameCB(const ImageMsg::UniquePtr &msg, const APA102Interface::SharedPtr &panel, const rclcpp::Time &last_time, const std::string &panel_name)

Callback to execute when a message with new frame is received.

Parameters:
  • msg – ROS Image message received.

  • panelAPA102 panel for which LEDs should be set.

  • last_time – ROS time of the last message received.

  • panel_name – name of the panel for which the message was received, used for improved logging. Valid names are: ‘channel_1’, ‘channel_2’.

void PanelThrottleWarnLog(const std::string panel_name, const std::string message)

Logs a warning message to the panel throttle log. Since this is throttle warning, we need to add panel name condition to log from both panels.

Parameters:
  • panel_name – name of the panel for which the message was received, used for improved logging. Valid names are: ‘channel_1’, ‘channel_2’.

  • message – warning message to log.

Protected Attributes

int channel_1_num_led_
int channel_2_num_led_
double frame_timeout_
bool led_control_granted_
bool led_control_pending_
rclcpp::Time channel_1_ts_
rclcpp::Time channel_2_ts_