FlexBE / flexbe_app

The classic user interface (editor + runtime control) for the FlexBE behavior engine. See the flexbe_webui for latest
BSD 3-Clause "New" or "Revised" License
48 stars 49 forks source link

General Question: How to integrate appliocation logic the flexbe app? #41

Closed areindl closed 3 years ago

areindl commented 5 years ago

Hi all!

First of all: Thank you. Flexbe looks really interesting. I am rather new in the field of robotics and ROS. I found flexbe while looking for a hierarchical state machine.

I am building a voice user interface for one of our robots. A state machine is a very neat wait to structure and streamline the process, since there are many steps involved (STT, NLU, TTS,..).

However: I followed the Flexbe tutorials and I have a basic understanding of the tool. Yet one essential question remained. Maybe its obvious for you, but for a newbie it no: How do I integrate my application logic with the statemachine? Where do I actually put my files (python) to work with states and transitions?

I am very thankful for any help and I hope will contribute to this project as well in the future.

Best Areindl

pschillinger commented 5 years ago

Hey, thanks for the feedback!

The place to put your application logic are the states. Each state is implemented by a Python class and some of its methods as described in the tutorials. For example, you can have a TTS state implementation that expects as input data a string and then plays the audio while being active. Or an NLU state that gets the user's request and has multiple outcomes to denote the potential types that should be treated differently by the robot.

Then, the question is how to interface the state implementation with your existing libraries. Either you simply import them in the Python code or, the way that is most ROS-like, your libraries expose ROS interfaces and the state implementations then simply publish, subscribe, or send action goals.

I would recommend you take a look at existing state implementations here on Github to get some inspiration what works best in your case.