How to add a ROS camera to IRIS for gazebo simulation?

In this, you learn how to install a simple camera facing downwards
at bottom of IRIS quadrotor model in Gazebo and publish its frames on ROS(Kinetic).

This tutorial assumes your have cloned Firmware folder in ~/src/Firmware and
have successfully all its dependencies.

I) To install a camera in IRIS proceed as follows:-

  1. Open iris_base.xacro present in ~/src/Firmware/Tools/sitl_gazebo/models/rotors_description/urdf/
  2. Search in iris_base.xacro and add the
    following code just above it and save it.
<xacro:camera_macro
    namespace="${namespace}"
    parent_link="base_link"
    camera_suffix="red_iris"
    frame_rate="30.0"
    horizontal_fov="1.3962634"
    image_width="800"
    image_height="800"
    image_format="R8G8B8"
    min_distance="0.02"
    max_distance="300"
    noise_mean="0.0"
    noise_stddev="0.007"
    enable_visual="1"
    >
    <box size="0.05 0.05 0.05" />
    <origin xyz="0 0 -0.07" rpy="0 1.57079 0"/>
    </xacro:camera_macro>

Now, the camera is installed. You can take assistance of component_snippets.xacro to
understand the values.

II) If take a look a at component_snippets.xacro, you will come to know that
frames are published under /iris/camera_red_iris/image_raw , so to have it
on ros start simulator by the procedure mentioned in https://dev.px4.io/en/simulation/ros_interface.html
in What’s Happening behind the scenes section.

1 Like