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

Inmoov2 heart 2 #1418

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

Inmoov2 heart 2 #1418

wants to merge 181 commits into from

Conversation

supertick
Copy link
Contributor

@supertick supertick commented Apr 23, 2024

In general this is the beginning of a much more structured approach of processing in python.
No longer fragile with name dependencies. No global vars at all except runtime.

  • Instead of a variety of python started timers, InMoov2 gets a heart to drive state and other functions. Simple runnable Heart, publishes a heartbeat
  • No python processing untill after "boot" which is when all configuration has processed
  • Scripts executing in apply before InMoov2 has started completely removed
  • Boot function, driven through stages - verifies config has finished before executing scripts
  • Direct references removed from fsm and chatbot
  • getLastActivityTime checks for null
  • isPirActive() added
  • InMoov2 onAudioStart and onAudioEnd added - for callbacks in Python which turn off STT when audioPlayer is running
  • New functions playAudioFile, playMusic, nextPlay, searchPlay because its fun to turn InMoov into a jukebox (and this replaces InMoov2/system/1_AudioFile.py)
  • Removal of onStarted subscription management - it shouldn't be there because it makes it inaccessible to the user
  • FileIO generalized isExecutableAvailable to see if executable is available
  • Runtime checks to see if acpi is availble before checking battery level on Linux
  • Added publishHeartbeat and processMessage - for all future python side processing, potentially compabible with Jython and Py4j
  • InMoov2 setLocale exception when "brain" selected doesn't override i01.chatbot.yml currentBotName
  • Removed startMouth startChatBot which needs to be replaced by the more general startPeer

@@ -538,8 +538,7 @@ public Plan getDefault(Plan plan, String name) {
listeners.add(new Listener("publishStopAnimation", getPeerName("neoPixel")));
// listeners.add(new Listener("publishProcessMessage",
// getPeerName("python"), "onPythonMessage"));
listeners.add(new Listener("publishProcessMessage", getPeerName("python"), "onPythonMessage"));

listeners.add(new Listener("publishProcessMessage", getPeerName("python"), "onPythonMessage"));
Copy link
Contributor

Choose a reason for hiding this comment

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

should the callback method be onProcessMessage ? to follow our normal convention ? we can refactor this to make it consistent at a later time.

* Checks battery, flashes leds and processes all the configured checks in
* onHeartbeat at a regular interval
*/
public Heartbeat publishHeartbeat() {
Copy link
Contributor

Choose a reason for hiding this comment

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

this does break with convention a bit.. normally we'd have a publishHeartbeat(Heartbeat beat) ... that simply returns the Heartbeat passed... the code below here, could be handled in the heart thread itself instead.. and just invoking publishHeartbeat with the beat that it created in that cycle... just curious why the departure from that convention?

@@ -562,17 +667,32 @@ public void enableRandomHead() {
}
}

public void enable() {
Copy link
Contributor

Choose a reason for hiding this comment

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

could this list be more dynamic, perhaps from the default inmoov plan instead of this enumerated list here?

@@ -2018,105 +2229,6 @@ public void speakBlocking(String format, Object... args) {
}
}

@Deprecated /* use startPeers */
public void startAll() throws Exception {
startAll(null, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we leave this in and have it call startPeers ?

}

@Deprecated /* use startPeers */
public void startAll(String leftPort, String rightPort) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to above, can we just have this call startPeers? leave this method in for convenience sake?

@@ -2132,48 +2244,7 @@ public void startedGesture(String nameOfGesture) {
}

public void startHeartbeat() {
addTask(1000, "publishHeartbeat");
Copy link
Contributor

Choose a reason for hiding this comment

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

this time should be configurable or pulled out as a constant for the interval here..

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.

None yet

2 participants