Skip to content

Commit 4932adf

Browse files
committed
Fixed bug with robot env sensor
1 parent 2dbbef3 commit 4932adf

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

stream_simulator/base_classes/basic_sensor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def sensor_read(self):
234234

235235
while self.info["enabled"]:
236236
time.sleep(1.0 / self.hz)
237-
print("Sensor read", self.state)
237+
# print("Sensor read", self.state)
238238

239239
if self.state is None or self.state == "off":
240240
continue
@@ -353,6 +353,7 @@ def stop(self):
353353
- get_mode_rpc_server
354354
- set_mode_rpc_server
355355
"""
356+
self.logger.warning("Stopping sensor %s", self.name)
356357
self.info["enabled"] = False
357358
while not self.stopped:
358359
time.sleep(0.1)

stream_simulator/controllers/env_devices/controller_temperature_sensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ def get_simulation_value(self):
9797
if affections is None:
9898
return amb
9999

100-
print(affections)
100+
# print(affections)
101101
for a in affections:
102102
r = (1 - affections[a]['distance'] / affections[a]['range']) * \
103103
affections[a]['info']['temperature']
104104
temps.append(r)
105105

106106
mms = 0
107-
print(temps)
107+
# print(temps)
108108
if len(temps) > 0:
109109
mms = max(temps)
110110

@@ -114,6 +114,6 @@ def get_simulation_value(self):
114114
else:
115115
self.dynamic_value += (final_value - self.dynamic_value)/6
116116

117-
print(f"Temperature: {self.dynamic_value}")
117+
# print(f"Temperature: {self.dynamic_value}")
118118
return self.dynamic_value + random.uniform(-0.1, 0.1)
119119

stream_simulator/controllers/sensors/controller_env.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def sensor_read(self):
176176
tem_aff[a]['info']['temperature']
177177
temps.append(r)
178178

179+
final_temp = amb
179180
if len(temps) != 0:
180181
final_temp = max(temps)
181182
final_temp = amb if amb > final_temp else final_temp

0 commit comments

Comments
 (0)