1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#[doc(hidden)]
pub mod flight_patterns;
mod state;

pub use self::state::UavState;
pub use self::flight_patterns::PatternType;

use signal::SignalConfig;

/// Configuration options for a UAV in the simulation
#[derive(Copy, Clone, Serialize, Deserialize)]
pub struct UavConfig {
    /// The rate at which new measurements are obtained (not currently used)
    pub capture_rate: f32,

    /// The speed of the uav (in meters/second)
    pub speed: f32,

    /// Configuration options for how the UAV is controlled
    pub controller: UavController,

    /// Configuration options for how the UAV receives the signal
    pub receiver: SignalConfig,
}

/// Configuration options for how the UAV is controlled
#[derive(Copy, Clone, Serialize, Deserialize)]
pub struct UavController {
    /// The size of the bounding rectangle that contains the flight pattern
    pub pattern_size: [f32; 2],

    /// The center (or offset) of the flight pattern
    pub pattern_center: [f32; 2],

    /// The type of patten to use
    pub pattern_type: PatternType,
}

impl UavController {
    /// Create a new UAV controller using the specified parameters
    pub fn new(size: [f32; 2], center: [f32; 2], pattern_type: PatternType) -> UavController {
        UavController {
            pattern_size: size,
            pattern_center: center,
            pattern_type: pattern_type,
        }
    }
}