Skip to content

Commit

Permalink
#506 Raise an error when control is refused
Browse files Browse the repository at this point in the history
  • Loading branch information
KaoruNishikawa committed Mar 26, 2022
1 parent 3aee9a7 commit 6898193
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/controller/ROS_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
from necst.srv import Bool_srvResponse
from std_msgs.msg import String


class NECSTAuthorityError(Exception):
pass


class controller(object):

task_flag = False
Expand Down Expand Up @@ -186,11 +191,10 @@ def wrapper(self, *args,**kwargs):
elif self.auth == self.node_name:
ret = func(self, *args,**kwargs)
else:
ret = ""
#rospy.logwarn("This node don't have authority...")
self.log.warn("This node don't have authority...")
print("current authority : ", self.auth)
pass
raise NECSTAuthorityError(f"This node doesn't have authority. Current authority is at {self.auth}")
return ret
return wrapper

Expand Down

0 comments on commit 6898193

Please sign in to comment.