AutoBone: Add test button

This commit is contained in:
ButterscotchVanilla committed 2021-08-16 18:14:03 -04:00
1 parent 0a39c746a3
commit c163effe60
2 files changed
+18

No files matched your search

@@ -11,22 +11,26 @@ import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.event.MouseInputAdapter;
import io.eiren.gui.autobone.AutoBone;
import io.eiren.util.StringUtils;
import io.eiren.util.ann.ThreadSafe;
import io.eiren.vr.VRServer;
import io.eiren.vr.processor.HumanSkeletonWithLegs;
import io.eiren.vr.processor.HumanSkeleton;
import io.eiren.util.logging.LogManager;
public class SkeletonConfig extends EJBag {
private final VRServer server;
private final VRServerGUI gui;
private final AutoBone autoBone;
private Map<String, SkeletonLabel> labels = new HashMap<>();
public SkeletonConfig(VRServer server, VRServerGUI gui) {
super();
this.server = server;
this.gui = gui;
this.autoBone = new AutoBone(server);
setAlignmentY(TOP_ALIGNMENT);
server.humanPoseProcessor.addSkeletonUpdatedCallback(this::skeletonUpdated);
@@ -91,6 +95,17 @@ public class SkeletonConfig extends EJBag {
//*/
add(new TimedResetButton("Reset All", "All"), s(c(1, row, 1), 3, 1));
add(new JButton("Auto") {{
addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
LogManager.log.info("[AutoBone] Recording 250 samples at a 6 frame interval");
autoBone.startFrameRecording(250, 6);
LogManager.log.info("[AutoBone] Done recording! Processing frames...");
autoBone.processFrames();
}
});
}}, s(c(4, row, 1), 3, 1));
row++;
add(new JLabel("Chest"), c(0, row, 1));
@@ -4,6 +4,8 @@ import java.util.HashMap;
import java.util.Map.Entry;
import io.eiren.util.ann.ThreadSafe;
import io.eiren.util.logging.LogManager;
import io.eiren.util.StringUtils;
import io.eiren.vr.VRServer;
import io.eiren.vr.processor.HumanSkeleton;
import io.eiren.vr.processor.HumanSkeletonWithLegs;
@@ -112,6 +114,7 @@ public class AutoBone {
float error = getFootError(skeleton1, skeleton2);
float adjustVal = error * adjustRate;
LogManager.log.info("[AutoBone] Current position error: " + StringUtils.prettyNumber(error));
for (Entry<String, Float> entry : configs.entrySet()) {
float newLength = entry.getValue() + adjustVal;