How can I publish images to ROS from PX4 Gazebo SITL

Hi, I want to attach a camera sensor on PX4 drone in Gazebo SITL environment, then publish images to ROS. I wrote a Gazebo model sdf file and it works well in…the normal Gazebo. However, in PX4 Gazebo SITL (I ran “make posix_sitl_default gazebo”), it throws an error like below when I add the camera model I wrote.

[FATAL] [1497522126.103665066]: A ROS node for Gazebo has not been initialized, unable to load plugin. Load the Gazebo system plugin ‘libgazebo_ros_api_plugin.so’ in the gazebo_ros package)

How can I attach cameras that be able to publish images to ROS on PX4 drones in Gazebo?

Oops sorry it was on the developer’s documents.
The last section “What’s happening behind the scenes” in
https://dev.px4.io/en/simulation/ros_interface.html

Hi. I’m really new to px4, gazebo and ros. I followed the link that you posted. I ran the typhoon_h480.world and checked ros topics with ‘rostopic list’. However, I didn’t see any topics related to images.

I guess I’m not fully understanding the whole structure yet.
Could you please describe how you published images to ros from px4 Gazebo SITL?

@Keunwoo_Park How are you starting the ROS node? You need to republish the udp video stream in ROS to be able to see it in ros

1 Like

I figured out. iris_fpv_cam model worked instead of typhoon_h480.

Camera in typhoon_h480 model uses GeotaggedImagesPlugin. And the topic name isn’t assigned to the plugin. However, fpv_cam has a topic name (imageTopicName). So I could get images by RViz, when I used iris_fpv_cam.

Right…

  • iris_fpv_cam uses the gazebo_ros_camera plugin, which publishes images to ROS
  • The typhoon_h480 uses the gst_camera_plugin which streams video using gstreamer over a udp sink.

Now I see that the fpv_cam model name is not that obvious that it is a ros specific camera model.

1 Like