Skip to content

Commit

Permalink
Log whenever the combined status is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
aeshub committed Apr 25, 2024
1 parent c19f69d commit 00e5c1c
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
self.mqtt_publisher: MqttPublisher = MqttPublisher(mqtt_queue=mqtt_queue)
self.robot: RobotInterface = robot
self.state_machine: StateMachine = state_machine
self.logger: Logger = logging.getLogger("mqtt")

def _get_combined_robot_status(
self, robot_status: RobotStatus, current_state: States
Expand Down Expand Up @@ -90,6 +91,11 @@ def run(self) -> None:
timestamp=datetime.utcnow(),
)

self.logger.info(
f"Combined status has changed to {combined_status} from {previous_robot_status} "
f"with current state {self.state_machine.current_state}"
)

self.mqtt_publisher.publish(
topic=settings.TOPIC_ISAR_ROBOT_STATUS,
payload=json.dumps(payload, cls=EnhancedJSONEncoder),
Expand Down

0 comments on commit 00e5c1c

Please sign in to comment.