Конкретные состояния
ros2_ws/src/lesson_08/lesson_08/state_machine/WaterstriderStates.py
class ObjectDetectedState(State):
def __init__(self, c: Controller, object_name):
State.__init__(self, outcomes=['complite'])
self.__cntr = c
self.__object_name = object_name
def execute(self, userdata):
self.__cntr.set_step_running()
self.__cntr.log_info(f'Wait for detect object')
while self.__cntr.get_is_running():
if self.__cntr.get_target_position(self.__object_name) is not None:
break
return 'complite'