Add a gimbal to IRIS in gazebo

I just figured it out how to transplant the gimbal on typhoon H480 to IRIS.

  1. Change sdf document
    Copy the directory named iris in /Firmware/Tools/sitl_gazebo/models and rename the directory and the name in config file and sdf file as iris_gimbal. Copy the code of the gimbal part in typhoon’s sdf document and paste it into IRIS’s sdf document. You may have to adjust the position of the part. Don’t forget to change the input indexes of mount and legs in mavlink_interface plugin’s control_channels and copy the gimbal_controller plugin. For using mixer append in the next step’s post document, the channels of the gimbal should be after the existing channels just like what is done in typhoon’s sdf document.
    typhoon_h480.sdf You need to copy 152-657, 1345-1410, 1427-1470

  2. Add a new airframe
    Copy 1014_solo in Firmware/ROMFS/px4fmu_common/init.d-posix and rename it as 1999_iris_gimbal(You can also use other unused numbers). Don’t forget to add param set MNT_MODE_IN 0 to enable the mount or you can change this parameter later in QGC(The parameters will be saved at ~/.ros/epprom after a successful launch). Copy typhoon’s post document and rename it as 1999_iris_gimbal.post

  3. Add a new mixer file
    Create a mixer file named iris_gimbal.main.mix in /mixers including R: 4x only

  4. Edit the launch file
    Change the roslaunch file named mavros_posix_sitl.launch’s arg vehicle from iris into iris_gimbal

  5. Test the gimbal
    roslaunch px4 mavros_posix_sitl.launch
    then control the gimbal with mavros topic /mavros/mount_control/command
    Don’t forget to arm the vehicle

1 Like