RoboWaiter/BTExpansionCode/EXP/behavior_lib/act/MoveTo.py

31 lines
926 B
Python
Raw Normal View History

2024-01-04 22:51:33 +08:00
import py_trees as ptree
from EXP.behavior_lib._base.Act import Act
class MoveTo(Act):
can_be_expanded = True
num_args = 1
valid_args = Act.all_object | Act.tables_for_placement | Act.tables_for_guiding
2024-04-10 19:59:13 +08:00
# valid_args.add('Customer')
2024-01-04 22:51:33 +08:00
def __init__(self, target_place):
super().__init__(target_place)
self.target_place = target_place
@classmethod
def get_info(cls,arg):
info = {}
info['pre'] = set()
if arg in Act.all_object:
2024-04-10 19:59:13 +08:00
info['pre'] |= {f'Exists({arg})'}
# info['pre'] |= {f'Not RobotNear({arg})'}
info["add"] = {f'RobotNear({arg})'}
info["add"] |= {f'Not RobotNear({place})' for place in cls.valid_args if place != arg}
info["del_set"] = {f'RobotNear({place})' for place in cls.valid_args if place != arg}
info["del_set"] |= {f'Not RobotNear({arg})'}
info['cost'] = 10
2024-01-04 22:51:33 +08:00
return info