Skip to content

Commit

Permalink
[spot_basicZ_behaviors] add pu/down to switchbot device name ntry
Browse files Browse the repository at this point in the history
  • Loading branch information
sktometometo committed Nov 22, 2023
1 parent 6f80bd4 commit f4719ff
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def run_main(self, start_node, end_node, edge, pre_edge):

rospy.logdebug('run_main() called')

start_floor = start_node.properties['floor']

graph_name = edge.properties['graph']
start_id = list(filter(
lambda x: x['graph'] == graph_name,
Expand Down Expand Up @@ -145,7 +147,7 @@ def run_main(self, start_node, end_node, edge, pre_edge):
rospy.loginfo('calling elevator when riding...')
success_calling = False
switchbot_goal = SwitchBotCommandGoal()
switchbot_goal.device_name = start_node.properties['switchbot_device']
switchbot_goal.device_name = start_node.properties['switchbot_device_up'] if end_floor > start_floor else start_node.properties['switchbot_device_down']
switchbot_goal.command = 'press'
count = 0
while True:
Expand Down Expand Up @@ -186,7 +188,7 @@ def run_main(self, start_node, end_node, edge, pre_edge):
# call elevator from destination floor while
rospy.loginfo('calling elevator when getting off...')
switchbot_goal = SwitchBotCommandGoal()
switchbot_goal.device_name = end_node.properties['switchbot_device']
switchbot_goal.device_name = end_node.properties['switchbot_device_up'] if end_floor > start_floor else end_node.properties['switchbot_device_down']
switchbot_goal.command = 'press'
self.action_client_switchbot.send_goal(switchbot_goal)
##
Expand All @@ -199,7 +201,7 @@ def run_main(self, start_node, end_node, edge, pre_edge):
result_switchbot = self.action_client_switchbot.get_result()
while not rospy.is_shutdown():
switchbot_goal = SwitchBotCommandGoal()
switchbot_goal.device_name = start_node.properties['switchbot_device']
switchbot_goal.device_name = start_node.properties['switchbot_device_up'] if end_floor > start_floor else end_node.properties['switchbot_device_down']
switchbot_goal.command = 'press'
self.action_client_switchbot.send_goal_and_wait(switchbot_goal, execute_timeout=rospy.Duration(10))
if self.spot_client.wait_for_navigate_to_result(rospy.Duration(5)):
Expand Down

0 comments on commit f4719ff

Please sign in to comment.