Skip to content

Commit

Permalink
Put sensor manager logging back to default.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamenot committed Jan 7, 2024
1 parent ad7ce76 commit 92acfce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 4 additions & 5 deletions smarts/core/sensor_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class SensorManager:

def __init__(self):
self._logger = logging.getLogger(self.__class__.__name__)
self._logger.setLevel(logging.INFO)
self._sensors: Dict[str, Sensor] = {}

# {actor_id: <SensorState>}
Expand Down Expand Up @@ -179,12 +178,12 @@ def teardown(self, renderer):

def add_sensor_state(self, actor_id: str, sensor_state: SensorState):
"""Add a sensor state associated with a given actor."""
self._logger.info("Sensor state added for actor '%s'.", actor_id)
self._logger.debug("Sensor state added for actor '%s'.", actor_id)
self._sensor_states[actor_id] = sensor_state

def remove_sensor_state_by_actor_id(self, actor_id: str):
"""Add a sensor state associated with a given actor."""
self._logger.info("Sensor state removed for actor '%s'.", actor_id)
self._logger.debug("Sensor state removed for actor '%s'.", actor_id)
return self._sensor_states.pop(actor_id, None)

def remove_actor_sensors_by_actor_id(
Expand All @@ -203,7 +202,7 @@ def remove_actor_sensors_by_actor_id(
sensors_by_actor = self._sensors_by_actor_id.get(actor_id)
if not sensors_by_actor:
return []
self._logger.info("Target sensor removal for actor '%s'.", actor_id)
self._logger.debug("Target sensor removal for actor '%s'.", actor_id)
discarded_sensors = []
for sensor_id in sensors_by_actor:
self._actors_by_sensor_id[sensor_id].remove(actor_id)
Expand All @@ -219,7 +218,7 @@ def remove_sensor(
self, sensor_id: str, schedule_teardown: bool = False
) -> Optional[Sensor]:
"""Remove a sensor by its id. Removes any associations it has with actors."""
self._logger.info("Target removal of sensor '%s'.", sensor_id)
self._logger.debug("Target removal of sensor '%s'.", sensor_id)
sensor = self._sensors.get(sensor_id)
if not sensor:
return None
Expand Down
9 changes: 2 additions & 7 deletions smarts/core/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,16 +695,12 @@ def _meta_create_class_sensor_functions(cls):
setattr(
cls,
f"subscribed_to_{sensor_name}",
property(
partial(cls.subscribed_to, sensor_name=sensor_name)
),
property(partial(cls.subscribed_to, sensor_name=sensor_name)),
)
setattr(
Vehicle,
f"{sensor_name}",
property(
partial(cls.sensor_property, sensor_name=sensor_name)
),
property(partial(cls.sensor_property, sensor_name=sensor_name)),
)

def detach_all_sensors_from_vehicle(vehicle):
Expand All @@ -724,4 +720,3 @@ def _meta_create_sensor_functions(self):
# Bit of metaprogramming to make sensor creation more DRY
self._meta_create_instance_sensor_functions()
self._meta_create_class_sensor_functions()

0 comments on commit 92acfce

Please sign in to comment.