The vehicle is configured to have car steering (i.e. different wheel angles for inner and outer front wheel on the turn) and differential drive on the rear wheels. This requires a Lua script to control the servo mix for ArduPilot which is supplied in the scripts sub-directory.
Usage
Run Gazebo
ign gazebo -v4 -s -r daf_truck_runway.sdf
Run ArduPilot SITL - using sim_vehicle.py
Copy the script daf_xf_450_tractor_mixer.lua to the SITL scripts directory, then start SITL:
You may need to reboot the autopilot to ensure the additional scripting parameters are loaded.
Run ArduPilot SITL - using launch scripts
A launch script launch/runway-daf_xf_450_tractor.sh is provided as an alternative way to run SITL. It sandboxes the SITL environment and Lua scripts and is the approach used when running multi-vehicle simulations.
The approach recommended in the Ignition tutorials is to use ERB Templates. The template for this model is models/daf_xf_450_tractor/model.sdf.erb. It should be regarded as the primary source for the model.
To generate the model.sdf pass the template to erb on the command line with the sdf=true parameter:
cd models/daf_xf_450_tractor
erb -T 1 sdf=true model.sdf.erb > model.sdf
The template may also be used (without the sdf parameter) to inject a <model>...</model> element into a world template:
Suppose that the template was located at worlds/trucks_world.sdf.erb
<%
# load templates for the required models
def make_tractor_model(model_name, model_pose, fdm_port_in)
ERB.new(File.read('../models/daf_xf_450_tractor/model.sdf.erb'))
.result(binding)
end
# make the tractor models
tractor1_pose = '0 0 1.0 0 0 0'
tractor1_model = make_tractor_model('tractor1', tractor1_pose, 9002)
tractor2_pose = '10 0 1.0 0 0 0'
tractor2_model = make_tractor_model('tractor2', tractor2_pose, 9012)
%>
<?xml version="1.0" ?>
<sdf version="1.7">
<world name="truck_world">
<!-- other world XML here... -->
<!-- Inject the truck models -->
<%= tractor1_model %>
<%= tractor2_model %>
</sdf>
To generate the trucks_world.sdf from the template:
cd worlds
erb -T 1 trucks_world.sdf.erb > trucks_world.sdf
This PR adds an Ignition model for a DAF XF 450 Tractor.
https://user-images.githubusercontent.com/24916364/149665138-f921ac8d-1082-4822-a28c-d2c07f98ccaa.mov
The vehicle is configured to have car steering (i.e. different wheel angles for inner and outer front wheel on the turn) and differential drive on the rear wheels. This requires a Lua script to control the servo mix for ArduPilot which is supplied in the scripts sub-directory.
Usage
Run Gazebo
Run ArduPilot SITL - using
sim_vehicle.py
Copy the script
daf_xf_450_tractor_mixer.lua
to the SITL scripts directory, then start SITL:You may need to reboot the autopilot to ensure the additional scripting parameters are loaded.
Run ArduPilot SITL - using launch scripts
A launch script
launch/runway-daf_xf_450_tractor.sh
is provided as an alternative way to run SITL. It sandboxes the SITL environment and Lua scripts and is the approach used when running multi-vehicle simulations.From the
$ARDUPILOT_HOME
run:Start MAVProxy in a separate terminal:
ERB templates
When running multi-vehicle simulations each vehicle must have it's own control port configured in the ArduPilotPlugin xml.
The approach recommended in the Ignition tutorials is to use ERB Templates. The template for this model is
models/daf_xf_450_tractor/model.sdf.erb
. It should be regarded as the primary source for the model.To generate the
model.sdf
pass the template toerb
on the command line with thesdf=true
parameter:The template may also be used (without the
sdf
parameter) to inject a<model>...</model>
element into a world template:Suppose that the template was located at
worlds/trucks_world.sdf.erb
To generate the
trucks_world.sdf
from the template:Credits