forked from equinor/flotilla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobotModel.cs
80 lines (70 loc) · 2.66 KB
/
RobotModel.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Api.Controllers.Models;
#pragma warning disable CS8618
namespace Api.Database.Models
{
/// <summary>
/// The type of robot model
/// </summary>
public enum RobotType
{
/// WARNING:
/// Changing the names of these enum options is the same as changing their value,
/// so it will require updating the database with the new names because the enum
/// is stored as strings in database
TaurobInspector,
TaurobOperator,
ExR2,
Robot,
Turtlebot,
AnymalX,
AnymalD
}
public class RobotModel
{
public RobotModel() { }
public RobotModel(CreateRobotModelQuery query)
{
Type = query.RobotType;
BatteryWarningThreshold = query.BatteryWarningThreshold;
UpperPressureWarningThreshold = query.UpperPressureWarningThreshold;
LowerPressureWarningThreshold = query.LowerPressureWarningThreshold;
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }
/// <summary>
/// The type of robot model
/// </summary>
[Required]
public RobotType Type { get; set; }
/// <summary>
/// Lower battery warning threshold in percentage
/// </summary>
public float? BatteryWarningThreshold { get; set; }
/// <summary>
/// Upper pressure warning threshold in Bar
/// </summary>
public float? UpperPressureWarningThreshold { get; set; }
/// <summary>
/// Lower pressure warning threshold in Bar
/// </summary>
public float? LowerPressureWarningThreshold { get; set; }
/// <summary>
/// Lower battery threshold at which to allow missions to be scheduled, in percentage
/// </summary>
public float? BatteryMissionStartThreshold { get; set; }
/// <summary>
/// The average time in seconds spent by this model on a single tag (excluding recording duration for video/audio)
/// </summary>
public float? AverageDurationPerTag { get; set; }
public void Update(UpdateRobotModelQuery updateQuery)
{
BatteryWarningThreshold = updateQuery.BatteryWarningThreshold;
UpperPressureWarningThreshold = updateQuery.UpperPressureWarningThreshold;
LowerPressureWarningThreshold = updateQuery.LowerPressureWarningThreshold;
BatteryMissionStartThreshold = updateQuery.BatteryMissionStartThreshold;
}
}
}