Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior Tree #95

Open
wants to merge 326 commits into
base: develop
Choose a base branch
from

Conversation

micolspitale93
Copy link
Collaborator

Rostests already implements for the following pytree leafs:

  • harmoni_face: rostest harmoni_face face_pytree.test
  • harmoni_bot: rostest harmoni_bot lex_pytree.test
  • harmoni_tts: rostest harmoni_tts polly_pytree.test
  • harmoni_speaker: rostest harmoni_speaker speaker_pytree.test
  • harmoni_web: rostest harmoni_web web_pytree.test
  • harmoni_gesture (it is not working with noetic)

The remaining leaf's tests (harmoni_microphone, harmoni_camera, and harmoni_stt) are still work in progress.
If you want to test a already created Tree, you can run the following:

  • rostest harmoni_pattern pytree.test
    It will execute a try composed by a sequence of:
  • harmoni_bot
  • harmoni_tts
  • in parallel: harmoni_face, and harmoni_speaker

Still not handling the different HARMONI API in the testing (WORK IN PROGRESS)

@micolspitale93 micolspitale93 requested review from chrismbirmingham and RMichaelSwan and removed request for chrismbirmingham July 26, 2021 17:21
@chrismbirmingham
Copy link
Member

Great work so far! Everything you have done so far will be useful for future work. We appreciate the work that you have done getting a working example for integrating HARMONI with py_trees. However, for where the project is right now we have some additional requirements and recommendations for how we would like to see the integration happen:

  • Requirements
    • Behavior tree shall function on a multipc system.
    • Behavior tree shall use action client system for communication with packages.
    • Behavior tree shall not require modification of existing packages except for harmoni_pattern.
  • Recommendations
    • See if py_trees_ros will meet the needs for communication
    • Look at how the sequential pattern is structured, we intend for the behavior trees to function similarly
    • Before you do more coding work, give us a diagram for how the communication will happen between the behavior tree and packages and how transitions are made between different states and different parts of the tree.
  • Guiding questions
    • How does/can the blackboard fundamentally send and receive data? TCP/IP? Class communication? ROS?
    • Is it possible to read/write the blackboard from multiple PCs on the same network? If not, what are some workarounds?
    • What is blackboard's performance in terms of read/write responsiveness? Would you only send smaller variables over it, or could you also include dense data like images and sound?

In the future we will be looking at the possibility of a standalone python based HARMONI, but for now we want the py_trees to utilize the communication system we have already set up. The current revision of work should be saved as a separate branch so that we can use it later.

Copy link
Collaborator

@RMichaelSwan RMichaelSwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a lot of improvements have been made. I still need to test on my PC and review some of the newer non-leaf classes, but overall looks pretty good. One comment on commit history: use descriptive commits and/or squash commits together! I am not too picky on git history, but when I see multiple commits with the exact same comment, it does make it notably harder to understand what actually occurred.

@@ -255,6 +255,7 @@ def _get_viseme_data(self, data):
else:
behavior_data = data
viseme_set = []
#FIXME decommenta le righe
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#FIXME decommenta le righe

@@ -57,7 +57,7 @@ def do(self, data):
if type(data) == str:
if ".wav" in data:
data = self.file_path_to_audio_data(data)
duration = data["duration"]
duration = data["duration"]-0.5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave out magic numbers if not obvious. One option: make a constant, e.g. AUDIO_DELAY or something (the reason for or meaning of "0.5" should be clear).

Comment on lines 294 to 297
#FIXME
#vorrei scrivere
#self.result_msg = tts_response["audio_data"]
#ma scrivo
Copy link
Collaborator

@RMichaelSwan RMichaelSwan Oct 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed? Also, English please :) this is not the only instance.

INTERACTION = "Background_noInterazione"
VISUAL = "Background_visivo"
CARTA = "Carta"
RACCOLTA = "ConfirmRaccolta"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgive my lack of Italian, but could we get translations in comments at least? Ideally everything would be in English, but I can understand not reworking lower importance things. Much appreciated whatever you decide.

@@ -86,7 +86,9 @@ def _preempt_callback(self):
"""Used to signal a cancel/pause to the currently running service so
that a new goal can be received.
"""
self.service_manager.pause()
self.service_manager.stop()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this was working with pause, so not clear on why the change was made here. Stop might mean a service will require a more in-depth startup procedure to begin again

@@ -0,0 +1,175 @@
#!/usr/bin/env python3
Copy link
Collaborator

@RMichaelSwan RMichaelSwan Oct 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeated code is a warning sign/design smell. All the leaves in this pull request tend to have a similar structure which means a small architecture change (e.g. something with HarmoniServiceSever) would require identical modifications to all leaves. To reduce total amount of code, I would strongly recommend creating an abstract base class for all leaves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants