I have two models that run in gazebo. The first doesn’t using ardupilot and is a three wheel robot that can be controlled with keys. It’s the moving robot tutorial.
The second model is iris runway that is part of ardupilot / gazebo.
I’m using gazebo garden.
I would like have the iris track the moving robot at a fixed offset (range, elevation, azimuth).
This file is in the same folder as the two models, iris_runway.sdf and moving_robot.sdf.
Current error is
[Err] [Server.cc:159] Error Code 8: [/sdf/world[@name=“quad_rover_world”]/model[@name=“quad_rover”]/include[0]/uri:/home/john/ardupilot_gazebo/worlds/quad_rover_1.sdf:L9]: Msg: Failed to find top level / / for
Hello @jvorwald, it should be straightforward to add another model to the iris_runway.sdf world:
start with iris_runway.sdf.
copy the elements defining the moving robot in the tutorial to iris_runway.sdf.
adjust the pose so it doesn’t conflict with the iris.
The files iris_runway.sdf and moving_robot.sdf are world files, not models, so you won’t be able to include models defined in these files in another world. For that you’d need to create a separate model (see the iris_with_standoffs as an example) and then ensure that model is included in the GZ_SIM_RESOURCE_PATH.
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
Just so I can get a baseline, did you manage to run the truck-quadplane-landing.sh example as is, or is that not working for you either. It’s been a while since I’ve reviewed this, but have just checked the script and it’s running with the latest plugins etc (I’m now using Gazebo Harmonic, but that should not be a factor in whether the example works or not).
Hi Rhys,
I ran the truck-quadplane-runway.sh example. Then I compared model.sdf file to model.sdf.erb to identify the process needed to create .erb from .sdf. Then I applied the process to the iris quadcopter. Also tried to switch from plane to copter. One thing I didn’t do is create a config.param file for iris.
Rhys, the goal is to model two cameras mounted on a gremsy t3 v3 gimbal, on a quad copter.
I used gazebo garden.
My guess is either somewhere I’m still using plane instead copter or I need the config.param file for iris to specify the frame class and type.
Ok - that’s good as it means the system’s working (just saw the discord post as well).
I’ll see if I can get the example you want up and running and maybe add a PR with the extra scripts needed. So it’s two iris quads with gimbal on the truck trailer. I think the landing script is quadplane only - but that’s not the immediate problem, we’ll start with getting all the vehicles present and visible in mavproxy and take it from there.
Fantastic. But it’s two cameras on one vehicle, 3 axis gimbal. The cameras have lens with different focal lengths. But, I will fly two UAV at once to reduce clock time required. So you can implement two iris on the back of the truck. Later this has to be implemented on a harbour tug, instead of a truck at an airport, in rough seas.
There’s an issue with the orientation - some of the models (including the truck) had the wrong mapping from Gazebo ENU to ArduPilot NED. If all the models are consistent you don’t notice until using a compass or navsat sensor. It looks like the iris and runway (which have been fixed in ardupilot_gazebo) are inconsistent with the truck. The model pose needs a 90 deg z rotation, and the transform pose in the ArduPilotPlugin needs an extra z-rotation by 90 deg as well. This is why the copter is zooming off to the east in the map when the truck goes north. In Gazebo the iris is on the trailer.
That we can do also. We have a nice wave simulation - if you have a CAD model for the boat I can set something up. I put together a model for a large research vessel for tridge when investigating the quadplane, the physics didn’t scale quite right for that vessel (70+m), but something intermediate may behave better.
I have ship motion data, can that be used in the simulation. I would just scale the existing tugboat model. Put the tugboat in waves and let me control the amplitude of the waves. And let the tugboat be driven by data in a file.
Could do, or we can use the wave simulation I developed where you can specify the wave amplitude via a parameter (and control wave direction relative to the wind). The boat motion is governed by non-linear hydrostatic restoring physics, so it’s fairly realistic. The advantage then is that you can command a mission for the boat and the boat motion takes care of itself.