Skip to content

Commit

Permalink
some warns logs turned to info - default scripts load
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Mar 17, 2024
1 parent d106c07 commit 514293b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/myrobotlab/io/FileIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static public final boolean extract(String root, String src, String dst, boolean
String finalDst = gluePathsForwardSlash(dst, src);
File check = new File(finalDst);
if (check.exists() && !overwrite) {
log.warn("{} aleady exists - not extracting", finalDst);
log.info("{} aleady exists - not extracting", finalDst);
return false;
}

Expand Down
104 changes: 66 additions & 38 deletions src/main/java/org/myrobotlab/service/InMoov2.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
import org.myrobotlab.service.interfaces.TextPublisher;
import org.slf4j.Logger;

public class InMoov2 extends Service<InMoov2Config> implements ServiceLifeCycleListener, TextListener, TextPublisher, JoystickListener, LocaleProvider, IKJointAngleListener {
public class InMoov2 extends Service<InMoov2Config> implements ServiceLifeCycleListener, TextListener, TextPublisher,
JoystickListener, LocaleProvider, IKJointAngleListener {

public final static Logger log = LoggerFactory.getLogger(InMoov2.class);

Expand All @@ -61,7 +62,7 @@ public class InMoov2 extends Service<InMoov2Config> implements ServiceLifeCycleL
* This method will load a python file into the python interpreter.
*
* @param file
* file to load
* file to load
* @return success/failure
*/
@Deprecated /* use execScript - this doesn't handle resources correctly */
Expand Down Expand Up @@ -166,11 +167,15 @@ public static void main(String[] args) {
random.addRandom(3000, 8000, "i01", "moveLeftArm", 0.0, 5.0, 85.0, 95.0, 25.0, 30.0, 10.0, 15.0);
random.addRandom(3000, 8000, "i01", "moveRightArm", 0.0, 5.0, 85.0, 95.0, 25.0, 30.0, 10.0, 15.0);

random.addRandom(3000, 8000, "i01", "setLeftHandSpeed", 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0);
random.addRandom(3000, 8000, "i01", "setRightHandSpeed", 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0);
random.addRandom(3000, 8000, "i01", "setLeftHandSpeed", 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0,
8.0, 25.0);
random.addRandom(3000, 8000, "i01", "setRightHandSpeed", 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0, 8.0, 25.0,
8.0, 25.0);

random.addRandom(3000, 8000, "i01", "moveRightHand", 10.0, 160.0, 10.0, 60.0, 10.0, 60.0, 10.0, 60.0, 10.0, 60.0, 130.0, 175.0);
random.addRandom(3000, 8000, "i01", "moveLeftHand", 10.0, 160.0, 10.0, 60.0, 10.0, 60.0, 10.0, 60.0, 10.0, 60.0, 5.0, 40.0);
random.addRandom(3000, 8000, "i01", "moveRightHand", 10.0, 160.0, 10.0, 60.0, 10.0, 60.0, 10.0, 60.0, 10.0, 60.0,
130.0, 175.0);
random.addRandom(3000, 8000, "i01", "moveLeftHand", 10.0, 160.0, 10.0, 60.0, 10.0, 60.0, 10.0, 60.0, 10.0, 60.0,
5.0, 40.0);

random.addRandom(200, 1000, "i01", "setHeadSpeed", 8.0, 20.0, 8.0, 20.0, 8.0, 20.0);
random.addRandom(200, 1000, "i01", "moveHead", 70.0, 110.0, 65.0, 115.0, 70.0, 110.0);
Expand Down Expand Up @@ -259,7 +264,8 @@ public InMoov2Config apply(InMoov2Config c) {
super.apply(c);
try {

locales = Locale.getLocaleMap("en-US", "fr-FR", "es-ES", "de-DE", "nl-NL", "pl-PL", "ru-RU", "hi-IN", "it-IT", "fi-FI", "pt-PT", "tr-TR");
locales = Locale.getLocaleMap("en-US", "fr-FR", "es-ES", "de-DE", "nl-NL", "pl-PL", "ru-RU", "hi-IN", "it-IT",
"fi-FI", "pt-PT", "tr-TR");

if (c.locale != null) {
setLocale(c.locale);
Expand Down Expand Up @@ -499,7 +505,7 @@ public boolean exec(String pythonCode) {
* This method will try to launch a python command with error handling
*
* @param gesture
* the gesture
* the gesture
* @return gesture result
*/
public String execGesture(String gesture) {
Expand Down Expand Up @@ -527,7 +533,7 @@ public String execGesture(String gesture) {
* a filesystem file :P
*
* @param someScriptName
* execute a resource script
* execute a resource script
* @return success or failure
*/
public boolean execScript(String someScriptName) {
Expand Down Expand Up @@ -752,7 +758,7 @@ public void loadGestures() {
* file should contain 1 method definition that is the same as the filename.
*
* @param directory
* - the directory that contains the gesture python files.
* - the directory that contains the gesture python files.
* @return true/false
*/
public boolean loadGestures(String directory) {
Expand Down Expand Up @@ -851,7 +857,8 @@ public void moveHand(String which, Double thumb, Double index, Double majeure, D
moveHand(which, thumb, index, majeure, ringFinger, pinky, null);
}

public void moveHand(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) {
public void moveHand(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky,
Double wrist) {
invoke("publishMoveHand", which, thumb, index, majeure, ringFinger, pinky, wrist);
}

Expand Down Expand Up @@ -903,8 +910,10 @@ public void moveLeftHand(Double thumb, Double index, Double majeure, Double ring
moveHand("left", thumb, index, majeure, ringFinger, pinky, wrist);
}

public void moveLeftHand(Integer thumb, Integer index, Integer majeure, Integer ringFinger, Integer pinky, Integer wrist) {
moveHand("left", (double) thumb, (double) index, (double) majeure, (double) ringFinger, (double) pinky, (double) wrist);
public void moveLeftHand(Integer thumb, Integer index, Integer majeure, Integer ringFinger, Integer pinky,
Integer wrist) {
moveHand("left", (double) thumb, (double) index, (double) majeure, (double) ringFinger, (double) pinky,
(double) wrist);
}

public void moveRightArm(Double bicep, Double rotate, Double shoulder, Double omoplate) {
Expand All @@ -915,8 +924,10 @@ public void moveRightHand(Double thumb, Double index, Double majeure, Double rin
moveHand("right", thumb, index, majeure, ringFinger, pinky, wrist);
}

public void moveRightHand(Integer thumb, Integer index, Integer majeure, Integer ringFinger, Integer pinky, Integer wrist) {
moveHand("right", (double) thumb, (double) index, (double) majeure, (double) ringFinger, (double) pinky, (double) wrist);
public void moveRightHand(Integer thumb, Integer index, Integer majeure, Integer ringFinger, Integer pinky,
Integer wrist) {
moveHand("right", (double) thumb, (double) index, (double) majeure, (double) ringFinger, (double) pinky,
(double) wrist);
}

public void moveTorso(Double topStom, Double midStom, Double lowStom) {
Expand Down Expand Up @@ -945,7 +956,7 @@ public PredicateEvent onChangePredicate(PredicateEvent event) {
* comes in from runtime which owns the config list
*
* @param configList
* list of configs
* list of configs
*/
public void onConfigList(List<String> configList) {
this.configList = configList;
Expand Down Expand Up @@ -997,7 +1008,7 @@ public void onJoystickInput(JoystickData input) throws Exception {
* including lower level logs that do not propegate as statuses
*
* @param log
* - flushed log from Log service
* - flushed log from Log service
*/
public void onLogEvents(List<LogEntry> log) {
// scan for warn or errors
Expand Down Expand Up @@ -1060,8 +1071,7 @@ public void onPirOn() {
}
}
}



public void onPirOff() {
log.info("onPirOff");
}
Expand Down Expand Up @@ -1172,7 +1182,7 @@ public void onStarted(String name) {
subscribeTo(name, "publishOpenCVData");
break;
default:
log.warn("unknown peer %s not hanled in onStarted", peerKey);
log.info("unknown peer {} not handled in onStarted", peerKey);
break;
}

Expand Down Expand Up @@ -1309,7 +1319,8 @@ public Message publishMessage(Message msg) {
return msg;
}

public HashMap<String, Double> publishMoveArm(String which, Double bicep, Double rotate, Double shoulder, Double omoplate) {
public HashMap<String, Double> publishMoveArm(String which, Double bicep, Double rotate, Double shoulder,
Double omoplate) {
HashMap<String, Double> map = new HashMap<>();
map.put("bicep", bicep);
map.put("rotate", rotate);
Expand All @@ -1323,7 +1334,8 @@ public HashMap<String, Double> publishMoveArm(String which, Double bicep, Double
return map;
}

public HashMap<String, Object> publishMoveHand(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) {
public HashMap<String, Object> publishMoveHand(String which, Double thumb, Double index, Double majeure,
Double ringFinger, Double pinky, Double wrist) {
HashMap<String, Object> map = new HashMap<>();
map.put("which", which);
map.put("thumb", thumb);
Expand All @@ -1340,7 +1352,8 @@ public HashMap<String, Object> publishMoveHand(String which, Double thumb, Doubl
return map;
}

public HashMap<String, Double> publishMoveHead(Double neck, Double rothead, Double eyeX, Double eyeY, Double jaw, Double rollNeck) {
public HashMap<String, Double> publishMoveHead(Double neck, Double rothead, Double eyeX, Double eyeY, Double jaw,
Double rollNeck) {
HashMap<String, Double> map = new HashMap<>();
map.put("neck", neck);
map.put("rothead", rothead);
Expand All @@ -1360,7 +1373,8 @@ public HashMap<String, Double> publishMoveLeftArm(Double bicep, Double rotate, D
return map;
}

public HashMap<String, Double> publishMoveLeftHand(Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) {
public HashMap<String, Double> publishMoveLeftHand(Double thumb, Double index, Double majeure, Double ringFinger,
Double pinky, Double wrist) {
HashMap<String, Double> map = new HashMap<>();
map.put("thumb", thumb);
map.put("index", index);
Expand All @@ -1380,7 +1394,8 @@ public HashMap<String, Double> publishMoveRightArm(Double bicep, Double rotate,
return map;
}

public HashMap<String, Double> publishMoveRightHand(Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) {
public HashMap<String, Double> publishMoveRightHand(Double thumb, Double index, Double majeure, Double ringFinger,
Double pinky, Double wrist) {
HashMap<String, Double> map = new HashMap<>();
map.put("thumb", thumb);
map.put("index", index);
Expand Down Expand Up @@ -1469,7 +1484,8 @@ public void setHandSpeed(String which, Double thumb, Double index, Double majeur
setHandSpeed(which, thumb, index, majeure, ringFinger, pinky, null);
}

public void setHandSpeed(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) {
public void setHandSpeed(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky,
Double wrist) {
InMoov2Hand hand = getHand(which);
if (hand == null) {
warn("%s hand not started", which);
Expand All @@ -1479,12 +1495,14 @@ public void setHandSpeed(String which, Double thumb, Double index, Double majeur
}

@Deprecated
public void setHandVelocity(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky) {
public void setHandVelocity(String which, Double thumb, Double index, Double majeure, Double ringFinger,
Double pinky) {
setHandSpeed(which, thumb, index, majeure, ringFinger, pinky, null);
}

@Deprecated
public void setHandVelocity(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) {
public void setHandVelocity(String which, Double thumb, Double index, Double majeure, Double ringFinger, Double pinky,
Double wrist) {
setHandSpeed(which, thumb, index, majeure, ringFinger, pinky, wrist);
}

Expand All @@ -1500,7 +1518,8 @@ public void setHeadSpeed(Double rothead, Double neck, Double eyeXSpeed, Double e
setHeadSpeed(rothead, neck, eyeXSpeed, eyeYSpeed, jawSpeed, null);
}

public void setHeadSpeed(Double rothead, Double neck, Double eyeXSpeed, Double eyeYSpeed, Double jawSpeed, Double rollNeckSpeed) {
public void setHeadSpeed(Double rothead, Double neck, Double eyeXSpeed, Double eyeYSpeed, Double jawSpeed,
Double rollNeckSpeed) {
sendToPeer("head", "setSpeed", rothead, neck, eyeXSpeed, eyeYSpeed, jawSpeed, rollNeckSpeed);
}

Expand All @@ -1524,7 +1543,8 @@ public void setHeadVelocity(Double rothead, Double neck, Double eyeXSpeed, Doubl
}

@Deprecated
public void setHeadVelocity(Double rothead, Double neck, Double eyeXSpeed, Double eyeYSpeed, Double jawSpeed, Double rollNeckSpeed) {
public void setHeadVelocity(Double rothead, Double neck, Double eyeXSpeed, Double eyeYSpeed, Double jawSpeed,
Double rollNeckSpeed) {
setHeadSpeed(rothead, neck, eyeXSpeed, eyeYSpeed, jawSpeed, rollNeckSpeed);
}

Expand All @@ -1536,12 +1556,15 @@ public void setLeftArmSpeed(Integer bicep, Integer rotate, Integer shoulder, Int
setArmSpeed("left", (double) bicep, (double) rotate, (double) shoulder, (double) omoplate);
}

public void setLeftHandSpeed(Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) {
public void setLeftHandSpeed(Double thumb, Double index, Double majeure, Double ringFinger, Double pinky,
Double wrist) {
setHandSpeed("left", thumb, index, majeure, ringFinger, pinky, wrist);
}

public void setLeftHandSpeed(Integer thumb, Integer index, Integer majeure, Integer ringFinger, Integer pinky, Integer wrist) {
setHandSpeed("left", (double) thumb, (double) index, (double) majeure, (double) ringFinger, (double) pinky, (double) wrist);
public void setLeftHandSpeed(Integer thumb, Integer index, Integer majeure, Integer ringFinger, Integer pinky,
Integer wrist) {
setHandSpeed("left", (double) thumb, (double) index, (double) majeure, (double) ringFinger, (double) pinky,
(double) wrist);
}

@Override
Expand Down Expand Up @@ -1610,12 +1633,15 @@ public void setRightArmSpeed(Integer bicep, Integer rotate, Integer shoulder, In
setArmSpeed("right", (double) bicep, (double) rotate, (double) shoulder, (double) omoplate);
}

public void setRightHandSpeed(Double thumb, Double index, Double majeure, Double ringFinger, Double pinky, Double wrist) {
public void setRightHandSpeed(Double thumb, Double index, Double majeure, Double ringFinger, Double pinky,
Double wrist) {
setHandSpeed("right", thumb, index, majeure, ringFinger, pinky, wrist);
}

public void setRightHandSpeed(Integer thumb, Integer index, Integer majeure, Integer ringFinger, Integer pinky, Integer wrist) {
setHandSpeed("right", (double) thumb, (double) index, (double) majeure, (double) ringFinger, (double) pinky, (double) wrist);
public void setRightHandSpeed(Integer thumb, Integer index, Integer majeure, Integer ringFinger, Integer pinky,
Integer wrist) {
setHandSpeed("right", (double) thumb, (double) index, (double) majeure, (double) ringFinger, (double) pinky,
(double) wrist);
}

public boolean setSpeechType(String speechType) {
Expand Down Expand Up @@ -1778,7 +1804,8 @@ public ProgramAB startChatBot() {
chatBot.setPredicate("null", "");
// load last user session
if (!chatBot.getPredicate("name").isEmpty()) {
if (chatBot.getPredicate("lastUsername").isEmpty() || chatBot.getPredicate("lastUsername").equals("unknown") || chatBot.getPredicate("lastUsername").equals("default")) {
if (chatBot.getPredicate("lastUsername").isEmpty() || chatBot.getPredicate("lastUsername").equals("unknown")
|| chatBot.getPredicate("lastUsername").equals("default")) {
chatBot.setPredicate("lastUsername", chatBot.getPredicate("name"));
}
}
Expand All @@ -1794,7 +1821,8 @@ public ProgramAB startChatBot() {
// !chatBot.getPredicate("default", "lastUsername").equals("unknown")) {
// chatBot.startSession(chatBot.getPredicate("lastUsername"));
// }
if (chatBot.getPredicate("default", "firstinit").isEmpty() || chatBot.getPredicate("default", "firstinit").equals("unknown")
if (chatBot.getPredicate("default", "firstinit").isEmpty()
|| chatBot.getPredicate("default", "firstinit").equals("unknown")
|| chatBot.getPredicate("default", "firstinit").equals("started")) {
chatBot.startSession(chatBot.getPredicate("default", "lastUsername"));
invoke("publishEvent", "FIRST INIT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ public class InMoov2Config extends ServiceConfig {
*/
public long heartbeatInterval = 3000;

public boolean loadAppsScripts = false;
public boolean loadAppsScripts = true;

/**
* loads all python gesture files in the gesture directory
*/
public boolean loadGestures = false;
public boolean loadGestures = true;

/**
* executes all scripts in the init directory on startup
*/
public boolean loadInitScripts = false;
public boolean loadInitScripts = true;

/**
* default to null - allow the OS to set it, unless explicilty set
Expand Down

0 comments on commit 514293b

Please sign in to comment.