|
@@ -30,6 +30,7 @@ namespace uqac_ia_aspirobot.Agent
|
30
|
30
|
|
31
|
31
|
private readonly AgState _state;
|
32
|
32
|
private readonly IUi _ui;
|
|
33
|
+ private readonly IAgPerformanceSensor _agPerformanceSensor;
|
33
|
34
|
|
34
|
35
|
private static Thread _thread;
|
35
|
36
|
|
|
@@ -70,7 +71,7 @@ namespace uqac_ia_aspirobot.Agent
|
70
|
71
|
}
|
71
|
72
|
|
72
|
73
|
public AgAgent(IOptions<AgConfig> options,
|
73
|
|
- IEnvironment environment, AgState state, IUi ui,
|
|
74
|
+ IEnvironment environment, AgState state, IUi ui, IAgPerformanceSensor agPerformanceSensor,
|
74
|
75
|
IAgEngineEffector engineEffector, IAgVaccumEffector vaccumEffector)
|
75
|
76
|
{
|
76
|
77
|
_engineEffector = engineEffector;
|
|
@@ -79,6 +80,7 @@ namespace uqac_ia_aspirobot.Agent
|
79
|
80
|
_environment = environment;
|
80
|
81
|
_state = state;
|
81
|
82
|
_ui = ui;
|
|
83
|
+ _agPerformanceSensor = agPerformanceSensor;
|
82
|
84
|
|
83
|
85
|
_options = options.Value;
|
84
|
86
|
_state.LastThinkTime = DateTime.MinValue;
|
|
@@ -130,7 +132,7 @@ namespace uqac_ia_aspirobot.Agent
|
130
|
132
|
public void Think()
|
131
|
133
|
{
|
132
|
134
|
var now = DateTime.Now;
|
133
|
|
- if (_state.LastThinkTime.AddMilliseconds(_state.ThinkTimeInterval) <= now)
|
|
135
|
+ if (_state.LastThinkTime.AddMilliseconds(_state.ThinkTimeInterval) <= now || _agPerformanceSensor.Performance <= _options.LowPerformance)
|
134
|
136
|
{
|
135
|
137
|
if (_state.Destination == null && _state.DustyRooms.Any())
|
136
|
138
|
{
|