[SITL] Add gimbal and RGB camera to IRIS for Gazebo

Hi. I’m trying to add a gimbal and a RGB camera to the IRIS model, for Gazebo simulation (as a pan/tilt camera). I’ve been able to add a camera to the model, in a fixed position with respect to the iris frame.

I need to control the gimbal using (velocity) ros topics, but it would be fine to control directly the orientation of the camera in Gazebo. The first is prefered because after successful simulations I want to try it in field experiments. I also need to get the state of the gimbal from ROS, obviously.

  1. Is there a way to add a controlled gimbal to the IRIS model and command it from PX4 or from an offboard computer?
  2. How should I add a pan/tilt camera to the xacro files?

This recent topics are very close to what I pretend:

I’ve found this other topics relevant (up to some extent):

@fulano You can looks at the typhoon_h480 model to figure out how to add a gimbal to a vehicle.

A implementation example of using ROS to control the gimbal can be found here: https://404warehouse.net/2019/10/20/offboard-gimbal-control-using-mavros-for-object-tracking/

Thank you @Jaeyoung-Lim, very interesting work.

Correct me if I’m wrong, but as far as i’ve seen I have to add, from the typhoon_h480 model, the following set of lines:

to the Iris model, but using the gazebo_ros_camera as it says that the gstreamer version requieres more CPU power. The only issue I’m facing is that one file is in sdf format and the other is xacro, so I have to do the conversion (or should I try with the sdfs from the repo? I don’t see much parametrization in the sdf, for example, the camera fov is fixed, but seems easier and aligned with px4 actual code).

I have not worked with SDF nor URDF formats, nor with modifying the gazebo models, except to add a camera to the iris, that was pretty simple.

I’m sorry I’m not showing the result of these lines, but I can’t test it right now (as soon as I have it, I’ll post it here for future reference). I think your tips point in the right direction.

I don’t have those plugins, most probably because of an older version of mavros and mavros_extras. Nonetheless, I might update to have those, after some testing of versions compatibility. I understand you have created a plugin that simulates the gimbal attached to and controlled by the autopilot, what is exactly I was looking for :smile: (different from controlling the gazebo object directly).

Thank you!