<?xml version="1.0"?>
<root BTCPP_format="4">
  <BehaviorTree ID="AutonomousCoordinator">
    <ReactiveFallback name="RootFallback">
      <Inverter><CheckEmergencyStop/></Inverter>
      <Sequence name="AutonomousSequence">
        <SetBlackboardVariable var_name="current_mode" var_value="idle"/>
        <Sequence name="IdleState">
          <StopRobot/>
          <WaitForActivation timeout_ms="60000"/>
        </Sequence>
        <Sequence name="PatrolState">
          <SetBlackboardVariable var_name="current_mode" var_value="patrol"/>
          <CheckBatteryLevel threshold="20"/>
          <PatrolWithCuriosity/>
        </Sequence>
        <Sequence name="InvestigateState">
          <SetBlackboardVariable var_name="current_mode" var_value="investigate"/>
          <FollowDetectedPerson/>
        </Sequence>
        <Sequence name="InteractState">
          <SetBlackboardVariable var_name="current_mode" var_value="interact"/>
          <RecognizeAndGreet/>
          <Wait wait_duration="30"/>
        </Sequence>
        <Sequence name="ReturnState">
          <SetBlackboardVariable var_name="current_mode" var_value="return"/>
          <NavigateToHome retry_count="3"/>
          <StopRobot/>
        </Sequence>
      </Sequence>
    </ReactiveFallback>
  </BehaviorTree>
</root>
