Depth images on rostopic using iris_depth_camera model

|Description:|Ubuntu 16.04.6 LTS|
|Release:|16.04|
|Codename:|xenial|
Gazebo: 8.6.0
Firmware package latest till the date of posting this.

Hello,
As I looked in the Firmware package, there is a model of iris_depth_camera. I created a world file by replicating the iris_fpv_cam.world file which is available under /Tool/sitl_gazebo/worlds in Firmware package. Then I ran the following commands in the Firmware folder in different terminals.

  • no_sim=1 make px4_sitl_default gazebo
  • roslaunch gazebo_ros empty_world.launch world_name:=$(pwd)/Tools/sitl_gazebo/worlds/iris_depth_camera.world
  • Also started mavros node using this command for localhost: roslaunch mavros px4.launch fcu_url:=“udp://:14540@127.0.0.1:14557”

Here is was able to see model of iris with a depth camera on it in the gazebo simulation, Now I wanted to understand how to get the depth image output of this camera on a ROS topic, is it even possible? if yes what are the steps towards it?

Thank you

yes, you can. Once you have launch the simulation you can run on another terminal rostopic list and you will see a bunch of /camera/.. topics. These are all the topics that the camera plugin publishes. Then you need a subscriber for the depth image in the ROS node you have set up. You can see here (https://github.com/PX4/avoidance/blob/master/safe_landing_planner/src/nodes/safe_landing_planner_node.cpp#L25-L26) how you can do that.

Hey @mrivi ,
Thanks for replying.
I ran this roslaunch gazebo_ros empty_world.launch world_name:=$(pwd)/Tools/sitl_gazebo/worlds/iris_depth_camera.world verbose:=true, i received following
[Err] [Plugin.hh:165] Failed to load plugin …/Firmware/build/px4_sitl_default/build_gazebo/librealsense_gazebo_plugin.so: libgazebo_sensor.so.7: cannot open shared object file: No such file or directory.

So i just switched to gazebo 7 after uninstalling gazebo 8. Then ran the above three commands, after that i was able to get the camera topis on ros.
But I additionally received the following errors while running the following command roslaunch gazebo_ros empty_world.launch world_name:=$(pwd)/Tools/sitl_gazebo/worlds/iris_depth_camera.world verbose:=true
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_multirotor_base_plugin.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_motor_model.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_motor_model.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_motor_model.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_motor_model.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_gps_plugin.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_magnetometer_plugin.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_barometer_plugin.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_mavlink_interface.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:165] Failed to load plugin /Firmware/build/px4_sitl_default/build_gazebo/libgazebo_imu_plugin.so: libgazebo_physics.so.8: cannot open shared object file: No such file or directory
So when I ran mavros, I was unable to receive odometry or any other sensor values.

Now if get camera topics, I’m not able to fly drone (using mavros offboard) and if I’m able to fly drone not able to get camera topics on ros. So now how to get both of these things together as one needs gazebo 7 and the other needs gazebo 8. Has anyone faced such an issue before or is there an alternate solution for such situation.

most likely something went wrong when you uninstalled gazebo8 and installed gazebo7. If you are on ros kinetic, uninstall both gazebo 7 and 8 and run apt-get ros-kinetic-gazebo-* and you should have a working system

Hey @mrivi,
thanks for the reply.
Did the process as you mentioned, added gazebo 7. I was able to get the camera topic and other sensor topics too, thanks for it.

I also tried the same for gazebo 8, but got the same error as before.
[Err] [Plugin.hh:165] Failed to load plugin …/Firmware/build/px4_sitl_default/build_gazebo/librealsense_gazebo_plugin.so: libgazebo_sensor.so.7: cannot open shared object file: No such file or directory .
wanted to know that is there a realsense plugin under Firmware package (named librealsense_gazebo_plugin.so) for gazebo 8?,

if you got gazeb7 to work I would stick with it. No reason to go to Gazebo8.
What are you launching to get the librealsense_gazebo_plugin.so error?

1 Like

Hey @mrivi ,
Got it sorted, thanks for the help.