skill_fsm_simple¶
Overview¶
The kill_fsm_simple application demonstrates how a finite state machine (FSM) works within a skill. It simulates an interactive scenario where the robot asks the user to identify their current location. The process includes audio feedback, LED animations, and a chest display with selectable choices. The FSM completes when the correct answer is selected.
Execution¶
Run the application with:
python3 skill_fsm_simple/ --auto-run
FSM States¶
RECEIVING_TASK: Plays a success sound, logs the setup result, and starts the FSM. Then, plays the success sound again and triggers a blue talking LED animation on the robot’s head. It then transitions to ASK_CURRENT_PLACE.
ASK_CURRENT_PLACE: Displays a multiple-choice question on the robot’s chest, asking: “Where am I?” It waits for user input. If the user selects “Colombia”, it transitions to END. If the selection is incorrect, it moves to WRONG_ANSWER.
WRONG_ANSWER: Plays the wrong_answer sound and notifies the user. It then returns to ASK_CURRENT_PLACE for the user to try again.
END: Plays the task_finished sound. The FSM then finishes.
State Transitions¶
Start → RECEIVING_TASK
RECEIVING_TASK → ASK_CURRENT_PLACE
ASK_CURRENT_PLACE → END (if correct answer)
ASK_CURRENT_PLACE → WRONG_ANSWER (if incorrect) → ASK_CURRENT_PLACE (retry)
Inputs¶
The user selects the location from the options displayed on the robot’s chest (“Where am I?”).
Outputs¶
The application logs transitions between states in the FSM.
Displays a chest interface with the question “Where am I?” for user input.
Executes tasks such as playing sounds and showing LED animations during the FSM process.
Prints the results of the setup (setup result: {result}), execution (execute_main result: {result}), and finish (execute_finish result: {result}) of the skill.
Example Output¶
[WARNING] [timestamp] [pyraya.kill_fsm_simple]: setup result: true
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Transition: -> RECEIVING_TASK
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Playing sound: success
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: LED animation: talking (blue)
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Transition: RECEIVING_TASK -> ASK_CURRENT_PLACE
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Showing chest component: "Where am I?"
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Transition: ASK_CURRENT_PLACE -> WRONG_ANSWER
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Playing sound: wrong_answer_sound
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Transition: WRONG_ANSWER -> ASK_CURRENT_PLACE
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Transition: ASK_CURRENT_PLACE -> END
[INFO] [timestamp] [pyraya.fsm.FSM_Simple]: Playing sound: task_finished
[WARNING] [timestamp] [pyraya.kill_fsm_simple]: execute_main result: true
[WARNING] [timestamp] [pyraya.kill_fsm_simple]: execute_finish result: true