/
QuadcopterIRRF.cs
47 lines (26 loc) · 963 Bytes
/
QuadcopterIRRF.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assignment9Queadcopters
{
class QuadcopterIRRF : QuadcopterIR
{
new public void select_comm_method()
{
//creating a dictionary to link strings to corresponding SNR value
Dictionary<string, float> types = new Dictionary<string, float>()
{
{"IR", SNR_IR },
{"RF", SNR_RF},
};
//gives max the string thats linked to the highest SNR value
var max = types.Aggregate((l, r) => l.Value > r.Value ? l : r).Key;
if(max == "IR") { IR = true;RF = false; }
else { RF = true; IR = false; }
Console.WriteLine("Quadcopter IRRF is now using {0} communication", max);
//Console.WriteLine("IR:{0} RF:{1}",IR,RF);
}
}
}