No data from /mavros/state

I’m trying to get the current mode of my SITL aircraft, and I’m not getting any data from this ros2 topic /mavros/state.

The topic has no publishers, I cannot for the life of me pin down what is responsible for the lack of publishers to this topic. I’ve narrowed my search to a few key files, but still haven’t the faintest on what’s breaking in the conversion between mavlink messages and ROS2 messages.

My current (rudimentary) understanding of the flow of MAVLINK messages to ROS2 topics is as follows:

We obtain mavlink messages by connecting to UDP / TCP that our flight controller or SITL is streaming to using the MAVROS node located at /opt/ros/humble/share/mavros/launch/node.launch

Then mavros_plugins.xml located at /opt/ros/humble/share/mavros/mavros_plugins.xml defines the sys_status plugin

then the SystemStatusPlugin located here mavros/mavros/src/plugins/sys_status.cpp at master · mavlink/mavros · GitHub
subscribes to the mavlink messages, within the same file (sys_status.cpp)

This method creates a new mavros_msgs::State message and populates it with data from the heartbeat

	void handle_heartbeat(const mavlink::mavlink_message_t *msg, mavlink::minimal::msg::HEARTBEAT &hb)
	{
		using mavlink::minimal::MAV_MODE_FLAG;

		// Store generic info of all heartbeats seen
		auto it = find_or_create_vehicle_info(msg->sysid, msg->compid);
		// update context && setup connection timeout
		m_uas->update_heartbeat(hb.type, hb.autopilot, hb.base_mode);
		m_uas->update_connection_status(true);
		timeout_timer.stop();
		timeout_timer.start();
		auto vehicle_mode = m_uas->str_mode_v10(hb.base_mode, hb.custom_mode);
		auto stamp = ros::Time::now();

I’m not sure how to verify data is flowing between any one of these steps to pinpoint whats breaking down.