Skip to content

Commit

Permalink
fix erro
Browse files Browse the repository at this point in the history
Signed-off-by: tkhmy <[email protected]>
  • Loading branch information
tkhmy committed Dec 4, 2024
1 parent 7989b47 commit b20116e
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions src/external_signage/src/external_signage/external_signage_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import serial
import json
import os
import rclpy
from std_srvs.srv import SetBool
from std_msgs.msgs import Bool
from std_msgs.msg import Bool
from ament_index_python.packages import get_package_share_directory
import external_signage.packet_tools as packet_tools
import uuid
Expand Down Expand Up @@ -114,7 +115,8 @@ def __init__(self, node):
)
self.parser = packet_tools.Parser(self.bus)
self._external_signage_available = True
except:
except Exception as e:
self.node.get_logger().error(str(e))
self._external_signage_available = False

self.displays = {
Expand Down Expand Up @@ -181,24 +183,32 @@ def trigger_external_signage(self, request, response):
if self._settings["in_experiment"]:
return response

if request.data:
self.display_signage("auto")
else:
self.display_signage("null")
try:
if request.data:
self.display_signage("auto")
else:
self.display_signage("null")
response.success = True
except Exception as e:
self.node.get_logger().error(str(e))
return response

def experiment_set(self, request, response):
if request.data:
self.pub_mode_status(True)
self._settings["in_experiment"] = True
self.display_signage("experiment")
else:
self.pub_mode_status(False)
self._settings["in_experiment"] = False
self.display_signage("null")
try:
if request.data:
self.pub_mode_status(True)
self._settings["in_experiment"] = True
self.display_signage("experiment")
else:
self.pub_mode_status(False)
self._settings["in_experiment"] = False
self.display_signage("null")

with open(self._settings_file, "w") as f:
json.dump(self._settings, f, indent=4)
with open(self._settings_file, "w") as f:
json.dump(self._settings, f, indent=4)
response.success = True
except Exception as e:
self.node.get_logger().error(str(e))
return response

def display_signage(self, display_file):
Expand Down

0 comments on commit b20116e

Please sign in to comment.