ROS2 IRIS Rp_lidar gazebo simulation sensor data unavailable

I want to use iris rplidar model in gazebo simulation to test collision avoidance algorithms in forest-like environment. I am using ros2 framework for this but however I am unable to get the camera and lidar data on ros2 topics list.

I successfully launched the gazebo simulation using make px4_sitl gazebo-classic_iris_rplidar, after this I connect the ros2 mircodds to using micro-ros-agent udp4 --port 8888 command. Now from here I can easily control the drone using a ros2 package. But I cannot get the lidar and image data as ros2 topics.

When I do ros2 topic list following list is displayed
/fmu/in/obstacle_distance /fmu/in/offboard_control_mode /fmu/in/onboard_computer_status /fmu/in/sensor_optical_flow /fmu/in/telemetry_status /fmu/in/trajectory_setpoint /fmu/in/vehicle_attitude_setpoint /fmu/in/vehicle_command /fmu/in/vehicle_mocap_odometry /fmu/in/vehicle_rates_setpoint /fmu/in/vehicle_trajectory_bezier /fmu/in/vehicle_trajectory_waypoint /fmu/in/vehicle_visual_odometry /fmu/out/failsafe_flags /fmu/out/sensor_combined /fmu/out/timesync_status /fmu/out/vehicle_attitude /fmu/out/vehicle_control_mode /fmu/out/vehicle_global_position /fmu/out/vehicle_gps_position /fmu/out/vehicle_local_position /fmu/out/vehicle_odometry /fmu/out/vehicle_status /parameter_events /rosout

I can see the sensor data using gazebo topic visualisation.

From the previous topic I see that it is a plugin issue but I couldn’t get an idea how to solve it.

@Rugved_katole I don’t think it is expected to publish lidar topics to ros2

You need to check whether the gazebo rplidar plugin should be publishing to ros2 or not: PX4-SITL_gazebo-classic/model.sdf at 5610c3fb441a2f3babc8ad7a63c8c4ce3e40abfa · PX4/PX4-SITL_gazebo-classic · GitHub

Thanks for your reply.

I tried to do that
I changed it as given in ros2 Migration guide But still I am unable to get them as ros2 topics. My sdf file for rplidar is as follows.

<?xml version="1.0" ?>
      <pose>0 0 0 0 0 0</pose>

    <visual name="visual">
          <size>0.02 0.05 0.05</size>

    <sensor name="laser" type="ray">
      <plugin name="laser" filename="" />
      <plugin name="gazebo_ros_head_rplidar_controller" filename="">
          <!-- <remapping>~/out:=scan</remapping> -->

I am very new to using the gazebo plugins. If you could point out what changes I need to make to get it as ros2 topics, it would be great.