Adding camera to iris drone in gazebo simulation and publish images to ROS topic


I am trying to add a camera to the iris drone to my gazebo simulation. I tried using many models (iris_fpv_cam, iris_downward_depth_camera, iris_stereo_camera …) by changing px4 launch files’ vehicle argument. But i keep getting:

Error: Unknown model 'iris_fpv_cam'
ERROR [px4] Startup script returned with return value: 256

I also tried to modify iris.sdf and iris.xacro files as described here. And I get the following errors:

Error [] Required attribute[name] in element[collision] is not specified in SDF.
Error [] Error reading element <collision>
Error [] Error reading element <link>
Error [] Error reading element <model>
Error [] Unable to read element <sdf>
Error:   Could not find the 'robot' element in the xml file
         at line 81 in /build/urdfdom-UJ3kd6/urdfdom-0.4.1/urdf_parser/src/model.cpp
Error [] Unable to call parseURDF on robot model
Error [] parse as old deprecated model file failed.

Can someone please assist me on how to add a downward camera attached to my drones?

Thank you

1 Like


I have the same problem. Did you find a solution?

Hi @nazakarim I am also facing the same issue. Did you manage to fixed it ?

if you want to use iris_fpv_cam, keep the vehicle argument as ‘iris’ and change the sdf value to iris_fpv_cam directory.

<arg name="sdf" default="$(find mavlink_sitl_gazebo)/models/iris_fpv_cam/iris_fpv_cam.sdf"/>

or add another argument so you can choose the model type (iris_fpv_cam, iris_downward_depth_camera, iris_stereo_camera …)

<arg name="model" value="iris_fpv_cam" />
<arg name="sdf" default="$(find mavlink_sitl_gazebo)/models/$(arg model)/$(arg model).sdf"/>

1 Like

Thanks alot that will do it.

How to connect that “iris_fpv_cam” to “darknet ros” webcam/camera topic to get raw images to use? I would like to active yolo to detect images via “darknet ros” in px4 too which I had done it at ArduCopter drone with ros gazebo ardupilot; but how can we do the same subject in px4 ros gazebo too? thank you.

I assume you are using leggedrobotics/darknet_ros for the object detection module. All you need to do is change the camera topic inside the config file darknet_ros/config/ros.yaml as stated in Readme/basic-usage with the camera topic from iris_fpv_cam. If you aren’t sure, just run the iris fpv and then do rostopic list from the terminal to find the image topic name


Hello @haritsahm , you technique works for when i launch “mavros_posix_sitl.launch” but fails when I launch “multi_uav_mavros_sitl.launch”.
The first one launches vehicle by referring to posix_sitl.launch but the multi-vehicle simulation file refers to “single_vehicle_spawn.launch” that in turn try to find "iris_fpv_cam_base.xacro" inside models/rotor_description/urdf folder which is not present there.
Can you suggest the work around for this. I need to simulated multiple vehicles with camera for my application?


1 Like

@Ranjeet Did you find a solution to your problem ?

Hello @GilfoyleScofield, i was not visiting the forum for months so did not see your question.

I followed the link to add a camera at the bottom of Xacro file of the iris itself. Did not find “iris_fpv_cam_base.xacro”.
The link gives you a work around and u should be able to get the camera working and attached to iris copter.

The graph of nodes launched is shown below where you can see cameras launched as separate nodes but are attached to copter frame in iris.xacro file and you can use the topics published by camera for your application. Hope this helps.

I have launched two iris drones so two cameras are there.