Skip to content

Commit

Permalink
Fix/loading (#63)
Browse files Browse the repository at this point in the history
* reset data when no schedule is found

Signed-off-by: tkhmy <[email protected]>

* fix loading page

Signed-off-by: tkhmy <[email protected]>

---------

Signed-off-by: tkhmy <[email protected]>
  • Loading branch information
tkhmy authored Apr 7, 2023
1 parent a0a3dab commit 93d7b76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/signage/src/signage/ros_service_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@


class RosServiceInterface:
def __init__(self, node):
def __init__(self, node, parameter_interface):
self._node = node
self._created_client_dict = {}
self._lock = threading.RLock()

self._cli_accept_start = self.__create_client(AcceptStart, "/api/motion/accept_start")
self._parameter = parameter_interface.parameter
if self._parameter.signage_stand_alone:
self._cli_accept_start = self.__create_client(AcceptStart, "/api/motion/accept_start")

# service call function
def accept_start(self):
request = AcceptStart.Request()
self.__service_call(self._cli_accept_start, request, True)
if self._parameter.signage_stand_alone:
request = AcceptStart.Request()
self.__service_call(self._cli_accept_start, request, True)

# common denominator
def __create_client(self, service_type, service_name):
Expand Down
6 changes: 6 additions & 0 deletions src/signage/src/signage/route_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def process_station_list_from_fms(self, force_update=False):
data = json.loads(respond.text)

if not data:
self._schedule_details = utils.init_ScheduleDetails()
self._display_details = utils.init_DisplayDetails()
self._current_task_details = utils.init_CurrentTask()
raise Exception("No data from fms")
elif utils.check_schedule_update(self._schedule_details, data) and not force_update:
self._fms_check_time = self._node.get_clock().now()
Expand All @@ -166,6 +169,9 @@ def process_station_list_from_fms(self, force_update=False):
self.task_list = utils.seperate_task_list(data.get("tasks", []))

if not self.task_list.doing_list:
self._schedule_details = utils.init_ScheduleDetails()
self._display_details = utils.init_DisplayDetails()
self._current_task_details = utils.init_CurrentTask()
raise Exception("doing_list is not found, skip")

for task in self.task_list.doing_list:
Expand Down
2 changes: 1 addition & 1 deletion src/signage/src/signage/signage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main(args=None):

autoware_interface = AutowareInterface(node)
parameter_interface = ParameterInterface(node)
ros_service_interface = RosServiceInterface(node)
ros_service_interface = RosServiceInterface(node, parameter_interface)
viewController = ViewControllerProperty(node, parameter_interface)
announceController = AnnounceControllerProperty(node, autoware_interface, parameter_interface)
route_handler = RouteHandler(
Expand Down

0 comments on commit 93d7b76

Please sign in to comment.