Combine two working models for gz sim

Thanks, @rhys. Let me provide more details. I’m puzzled as to where the error is, or how to debug.

The framework is the truck-quadplane-landing.sh`example. Objective is 2 Iris quads each with 3 axis fpv with two cameras, flying fixed azimuth/elevation/range position relative to moving truck.

Status, iris shows up on the truck, but mavproxy only shows two vehicles, rover/rover instead of three, rover/rover/quad.

Error is most likely in the iris_with_autopilot.sdf.erb file. Here are the steps to create the erb file.

 1. Change to model directory
       mkdir ~/simulation/SITL_Models/Gazebo/models/iris_with_ardupilot
       cd ~/simulation/SITL_Models/Gazebo/models/iris_with_ardupilot
       cp ~/ardupilot_gazebo/models/iris_with_ardupilot/*.*

 2. Backup model.sdf
    (a) Copy files
       cp model.sdf model.sdf.bac

    (b) Note the xml and sdf version numbers in the model.sdf file
       <?xml version='1.0'?>
       <sdf version="1.9">

 3. Create empty file model.sdf.erb.
       touch model.sdf.erb
       code model.sdf.erb

    (a) Add these lines at the top.  Use the xml and sdf versions from above
       <%
         # defaults
         if !defined?(model_name) then model_name = 'iris_with_ardupilot' end
         if !defined?(model_pose) then model_pose = '0 0 0 0 0 0' end
         if !defined?(fdm_addr) then fdm_addr = '127.0.0.1' end
         if !defined?(fdm_port_in) then fdm_port_in = 9002 end
       
         # sdf header and footer
         header=''
         footer=''
         if defined?(sdf)
           header='<?xml version="1.0" ?>
       <!--
       DO NOT EDIT. This file is generated from an ERB template.
       
         erb -T 1 sdf=true model.sdf.erb > model.sdf
       
       -->
       <sdf version="1.9">'
           footer='</sdf>'
         end
       %>
       <%= header %>

 4. Add to the bottom of model.sdf.erb.all the lines from model.sdf

 5. From filemodel.sdf.erb remove the two lines added, 
       <?xml version="1.0"?>
       <sdf version="1.9">

 6. Find “model name”
    (a) Fix the model name
         i. change <model name="iris_with_ardupilot">
         ii. to <model name="<%= model_name %>">
 7. In the model level, before including “<uri>model://iris_with_standoffs</uri>”
    (a) Add the pose
         i. <pose><%= model_pose %></pose>

 8. Go down to ArduPilotPlugin section
    (a) Replace
          <fdm_addr>127.0.0.1</fdm_addr>
             <fdm_port_in>9002</fdm_port_in>

    (b) with
           <fdm_addr><%= fdm_addr %></fdm_addr>
           <fdm_port_in><%= fdm_port_in %></fdm_port_in>

 9. At the bottom of model.sdf.erb
    (a) Replaced
       </sdf>

    (b) with
       <%= footer %>

To run and see the error

 I. Terminal 1: Create SITL simulation files
   cd ~/ardupilot
   rm -rf sitl
   # mv sitl sitl_iris_1
   ./SITL_Models/Gazebo/launch/truck-quad_iris-landing.sh

 II. Terminal 2: Run world simulation
   cd ~/ardupilot/sitl/worlds
   gz sim -v 4 -r truck_quad_iris_landing.sdf

 III. Optional Terminal 3: Start QGroundControl (not done this time)
   cd ~/Desktop/
   QGroundControl.AppImage 

 IV.  Terminal 4 start mavproxy
   cd ~/ardupilot
   ./SITL_Models/Gazebo/launch/mavproxy-multi-vehicle.sh 3 

 V. There seems to be an error at this point.  Mavproxy console indicates a loop
   height 5

pre-arm good
height 589
pre-arm fail

You can get the errors to stop generating by typing vehicle 3 in mavproxy terminal.
Also, if you click on vehicle in mavproxy console, only shows two vehicles instead of three.

Attached zip file should contain all needed files. Generated with command executed in home directory

$ zip ./err_iris_truck.zip ./ardupilot/SITL_Models/Gazebo/launch/truck-quad_iris-landing.sh ./simulation/SITL_Models/Gazebo/worlds/truck_quad_iris_landing.sdf.erb ./simulation/SITL_Models/Gazebo/models/iris_with_ardupilot/.
adding: ardupilot/SITL_Models/Gazebo/launch/truck-quad_iris-landing.sh (deflated 65%)
adding: simulation/SITL_Models/Gazebo/worlds/truck_quad_iris_landing.sdf.erb (deflated 64%)
adding: simulation/SITL_Models/Gazebo/models/iris_with_ardupilot/model.config (deflated 56%)
adding: simulation/SITL_Models/Gazebo/models/iris_with_ardupilot/model.sdf (deflated 92%)
adding: simulation/SITL_Models/Gazebo/models/iris_with_ardupilot/model.sdf.bac (deflated 92%)
adding: simulation/SITL_Models/Gazebo/models/iris_with_ardupilot/model.sdf.erb (deflated 92%)
err_iris_truck.zip (9.7 KB)