ROS2/Gazebo: Ultrasonic sensor not working, no publisher for topic

I’m working on a robot simulation in ROS2 and Gazebo, but I’m encountering issues with my ultrasonic sensor. Here’s my problem:

I’ve set up an ultrasonic sensor in my robot model, but it’s not detecting objects (like a box) placed in front of it. The ROS topic for the ultrasonic sensor (/ultrasonic) exists, but it has a publisher count of 0. My obstacle_detection_node is running but constantly outputs: “No distance data available yet.” The ROS node graph doesn’t show any nodes related to the ultrasonic sensor.

I am getting this error alongside it: [gzserver-1] [ERROR] [1721927954.810636844] [ultrasonic_controller]: Invalid <output_type> [sensor_msgs]

Here’s what I’ve tried so far:

Checked the robot’s URDF/SDF file for proper sensor configuration Verified that the ultrasonic topic is listed when running ros2 topic list Attempted to echo the /ultrasonic topic (no data) Reviewed the obstacle_detection_node code Checked Gazebo world settings Ensured ROS and Gazebo versions are compatible