Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Apr 27, 2024
1 parent 077f8b9 commit 605a163
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions src/main/java/org/myrobotlab/service/InMoov2.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void addTextListener(TextListener service) {
public InMoov2Config apply(InMoov2Config c) {
super.apply(c);
try {

if (c.locale != null) {
setLocale(c.locale);
} else {
Expand Down Expand Up @@ -314,7 +314,7 @@ synchronized public void boot() {
log.warn("will not boot again");
return;
}

if (bootCount == 0) {
info("%s BOOTING ....", getName());
}
Expand All @@ -326,28 +326,28 @@ synchronized public void boot() {
info("BOOT runtime still processing config set %s, waiting ....", runtime.getConfigName());
return;
}

if (!isReady()) {
info("BOOT %s is not yet ready, waiting ....", getName());
return;
}

info("BOOT starting mandatory services");

try {
// This is required the core of InMoov is
// a FSM ProgramAB and some form of Python/Jython
startPeer("fsm");

// Chatbot is a required part of InMoov2
ProgramAB chatBot = (ProgramAB)startPeer("chatBot");
ProgramAB chatBot = (ProgramAB) startPeer("chatBot");
chatBot = (ProgramAB) startPeer("chatBot");
chatBot.startSession();
chatBot.setPredicate("robot", getName());
} catch (IOException e) {
error(e);
}

// InMoov2 is now "ready" for mandatory synchronous processing
info("BOOT starting scripts");

Expand Down Expand Up @@ -763,7 +763,7 @@ public void finishedGesture(String nameOfGesture) {
* @param event
*/
public void fire(String event) {
FiniteStateMachine fsm =(FiniteStateMachine)getPeer("fsm");
FiniteStateMachine fsm = (FiniteStateMachine) getPeer("fsm");
if (fsm != null) {
fsm.fire(event);
} else {
Expand Down Expand Up @@ -861,20 +861,20 @@ public OpenCV getOpenCV() {
}

public String getPredicate(String key) {
ProgramAB chatBot = (ProgramAB)getPeer("chatBot");
ProgramAB chatBot = (ProgramAB) getPeer("chatBot");
if (chatBot != null) {
return getPredicate(chatBot.getConfig().currentUserName, key);
return getPredicate(chatBot.getConfig().currentUserName, key);
} else {
log.info("chatBot not ready");
return null;
}
}

public String getPredicate(String user, String key) {
ProgramAB chatBot = (ProgramAB)getPeer("chatBot");
ProgramAB chatBot = (ProgramAB) getPeer("chatBot");
if (chatBot != null) {

return chatBot.getPredicate(user, key);
return chatBot.getPredicate(user, key);
} else {
log.info("chatBot not ready");
return null;
Expand All @@ -888,14 +888,14 @@ public String getPredicate(String user, String key) {
* @return
*/
public Response getResponse(String text) {
ProgramAB chatBot = (ProgramAB)getPeer("chatBot");
ProgramAB chatBot = (ProgramAB) getPeer("chatBot");
if (chatBot != null) {

Response response = chatBot.getResponse(text);
return response;
Response response = chatBot.getResponse(text);
return response;
} else {
log.info("chatBot not ready");
return null;
return null;
}
}

Expand Down Expand Up @@ -1074,7 +1074,7 @@ public boolean accept(File dir, String name) {

if (files != null) {
for (File file : files) {

Python p = (Python) Runtime.getService("python");
if (p != null) {
p.execFile(file.getAbsolutePath());
Expand Down Expand Up @@ -1442,7 +1442,10 @@ public void onText(String text) {
}

// TODO FIX/CHECK this, migrate from python land
@Deprecated /* these are fsm states and should be implemented in python callbacks */
@Deprecated /*
* these are fsm states and should be implemented in python
* callbacks
*/
public void powerDown() {

rest();
Expand All @@ -1461,7 +1464,10 @@ public void powerDown() {

// TODO FIX/CHECK this, migrate from python land
// FIXME - defaultPowerUp switchable + override
@Deprecated /* these are fsm states and should be implemented in python callbacks */
@Deprecated /*
* these are fsm states and should be implemented in python
* callbacks
*/
public void powerUp() {
enable();
rest();
Expand Down Expand Up @@ -2025,7 +2031,7 @@ public boolean setPirPlaySounds(boolean b) {
}

public Object setPredicate(String key, Object data) {
ProgramAB chatBot = (ProgramAB)getPeer("chatBot");
ProgramAB chatBot = (ProgramAB) getPeer("chatBot");
if (data == null) {
chatBot.setPredicate(key, null); // "unknown" "null" other sillyness ?
} else {
Expand Down Expand Up @@ -2090,7 +2096,7 @@ public boolean setSpeechType(String speechType) {
}

public void setTopic(String topic) {
ProgramAB chatBot = (ProgramAB)getPeer("chatBot");
ProgramAB chatBot = (ProgramAB) getPeer("chatBot");
if (chatBot != null) {
chatBot.setTopic(topic);
} else {
Expand Down Expand Up @@ -2298,7 +2304,7 @@ public void waitTargetPos() {
public void foundPerson(String name) {
foundPerson(name, 1.0);
}

public void foundPerson(String name, Double confidence) {
if (confidence == null) {
confidence = 1.0;
Expand All @@ -2308,11 +2314,9 @@ public void foundPerson(String name, Double confidence) {
data.put("confidence", confidence);
invoke("publishFoundPerson", data);
}



public Map<String, Object> publishFoundPerson(Map<String, Object> data) {
return data;
}



}

0 comments on commit 605a163

Please sign in to comment.