Crate simulation [−] [src]
This crate provides functionality for configuring and running a simulation of a range-based tracking system.
Simulations are run by creating a SimulationRunner
(using the new
method) and calling
the step
method. Each step returns a new SimulationFrame
which contains all the
information about the simulation at a particular point in time.
Examples
SimulationConfig
implements the Default
trait, which allows you to quickly create and
use a new SimulationRunner
:
let num_steps = 100; let dt = 1.0; let mut simulation_runner = SimulationRunner::new(&Default::default()); for frame in (0..num_steps).map(|_| simulation_runner.step(dt)) { // Use simulation frame ... }Run
Alternatively you can define a specific configuration by creating a SimulationConfig
explicitly, or by loading one from a JSON file:
// Explicit configuration definition let config = SimulationConfig { // Config options... }; let mut simulation_runner = SimulationRunner::new(&config); // Use simulation runner ...Run
// Json loading using serde_json extern crate serde; extern crate serde_json; let mut file = File::open("config.json").unwrap(); let config = serde_json::from_reader(&mut file).unwrap(); let mut simulation_runner = SimulationRunner::new(&config); // Use simulation runner ...Run
For more information about custom configurations see the documentation for SimulationConfig
.
Configuration options
The easiest way to configure the simulation is to load a JSON file with the desired settings and loading (as shown above). The default configuration corresponds to the following JSON file:
{ "uavs": [ { "capture_rate": 1.0, "speed": 10.0, "controller": { "pattern_size": [50.0, 50.0], "pattern_center": [50.0, 50.0], "pattern_type": "Elliptical" }, "receiver": { "signal_noise": 0.01, "gain_pattern": "Uniform", "propagation_model": "FreeSpace" } } ], "animals": [ { "position": [50.0, 50.0], "speed": 0.6, "walk_variance": 0.1 } ], "map_size": [100.0, 100.0], "num_particles": 10000, "particle_noise": 2.0 }Run
Modules
animal | |
signal | |
uav |
Structs
FilterFrame |
A frame representing a single target (i.e. animal) at a particular point in time |
Measurement |
A measurement taken by a UAV at a particular point in time |
SimulationConfig |
Configuration options for a simulation |
SimulationFrame |
A snapshot of the simulation at a particular point in time |
SimulationRunner |
A structure for running a configured simulation |