use of artisynth.core.probes.NumericOutputProbe in project artisynth_core by artisynth.
the class ProbeInfo method editProbe.
// edit the probe
private void editProbe() {
NumericProbeEditor dialog;
if (getProbe().isInput()) {
dialog = new InputNumericProbeEditor((NumericInputProbe) getProbe());
} else {
dialog = new OutputNumericProbeEditor((NumericOutputProbe) getProbe());
}
dialog.setVisible(true);
Point loc = getMain().getFrame().getLocation();
dialog.setLocation(loc.x + getMain().getFrame().getWidth(), getMain().getFrame().getHeight());
myController.addProbeEditor(dialog);
}
use of artisynth.core.probes.NumericOutputProbe in project artisynth_core by artisynth.
the class InverseManager method configureTargetForceProbe.
private void configureTargetForceProbe(NumericProbeBase probe, ArrayList<ForceTarget> targets, String filename) {
// System.out.println ("configuring force probe");
ArrayList<Property> props = new ArrayList<Property>();
for (ForceTarget target : targets) {
props.add(target.getProperty("targetLambda"));
}
// probe.setModel(myController.getMech());
probe.setAttachedFileName(filename);
if (probe instanceof NumericInputProbe) {
((NumericInputProbe) probe).setInputProperties(props.toArray(new Property[props.size()]));
} else if (probe instanceof NumericOutputProbe) {
((NumericOutputProbe) probe).setOutputProperties(props.toArray(new Property[props.size()]));
}
if (probe instanceof NumericInputProbe) {
File file = probe.getAttachedFile();
if (file == null || !file.exists()) {
((NumericInputProbe) probe).loadEmpty();
probe.setActive(false);
} else {
try {
probe.load();
probe.setActive(true);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
use of artisynth.core.probes.NumericOutputProbe in project artisynth_core by artisynth.
the class InverseManager method configureTargetMotionProbe.
private void configureTargetMotionProbe(NumericProbeBase probe, ArrayList<MotionTargetComponent> targets, String filename) {
// System.out.println ("configuring motion probe");
ArrayList<Property> props = new ArrayList<Property>();
for (ModelComponent target : targets) {
if (target instanceof Point) {
props.add(target.getProperty("position"));
} else if (target instanceof Frame) {
props.add(target.getProperty("position"));
props.add(target.getProperty("orientation"));
} else {
System.err.println("Unknown target component type: " + target.getClass().toString());
}
}
// probe.setModel(myController.getMech());
probe.setAttachedFileName(filename);
if (probe instanceof NumericInputProbe) {
((NumericInputProbe) probe).setInputProperties(props.toArray(new Property[props.size()]));
} else if (probe instanceof NumericOutputProbe) {
((NumericOutputProbe) probe).setOutputProperties(props.toArray(new Property[props.size()]));
}
if (probe instanceof NumericInputProbe) {
File file = probe.getAttachedFile();
if (file == null || !file.exists()) {
((NumericInputProbe) probe).loadEmpty();
probe.setActive(false);
} else {
try {
probe.load();
probe.setActive(true);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
use of artisynth.core.probes.NumericOutputProbe in project artisynth_core by artisynth.
the class OutputNumericProbeEditor method setOutputProbe.
private void setOutputProbe() {
ArrayList<String> variableNames = new ArrayList<String>();
for (Map.Entry<String, NumericProbeVariable> entry : myVariables.entrySet()) {
variableNames.add(entry.getKey());
System.out.println("variable: " + entry.getKey() + " added to list");
}
for (Property prop : myProperties) {
System.out.println("property " + prop.getName() + " found");
}
// System.out.println("myProps size ="+myProperties.size());
// System.out.println("myVars size ="+variableNames.size());
NumericOutputProbe probeToSet;
if (oldProbe == null) {
probeToSet = new NumericOutputProbe();
} else {
probeToSet = oldProbe;
}
probeToSet.set(myProperties.toArray(new Property[0]), getDriverExpressions(), variableNames.toArray(new String[0]));
probeToSet.setStartTime(startTimeField.getDoubleValue());
probeToSet.setStopTime(endTimeField.getDoubleValue());
probeToSet.setName(probeNameField.getStringValue());
probeToSet.setUpdateInterval(intervalField.getDoubleValue());
if (!rangeField.valueIsVoid()) {
DoubleInterval range = rangeField.getRangeValue();
probeToSet.setDefaultDisplayRange(range.getLowerBound(), range.getUpperBound());
}
// probeToSet.setDefaultDisplayRange(
// dispLowerField.getDoubleValue(), dispUpperField.getDoubleValue());
probeToSet.setAttachedFileName(attachedFileField.getText());
if (oldProbe == null) {
AddComponentsCommand cmd = new AddComponentsCommand("add output probe", probeToSet, myMain.getRootModel().getOutputProbes());
myMain.getUndoManager().saveStateAndExecute(cmd);
// System.out.println("track index: "+probeToSet.getTrack());
// myMain.getRootModel().addOutputProbe(probeToSet);
// myMain.getTimeline().addProbe(probeToSet);
}
}
use of artisynth.core.probes.NumericOutputProbe in project artisynth_core by artisynth.
the class SkinDemo method addProbes.
public void addProbes() {
NumericInputProbe ip;
NumericOutputProbe op;
double rate = 0.01;
try {
String path = ArtisynthPath.getHomeRelativePath("src/artisynth/demos/mech/", ".");
ip = new NumericInputProbe(model, "axialSprings/muscle:excitation", path + "muscleArmActivation.txt");
ip.setStartStopTimes(0, 10.0);
ip.setName("Muscle Activation");
ip.setActive(false);
addInputProbe(ip);
} catch (Exception e) {
System.out.println("Error adding probe:");
e.printStackTrace();
}
}
Aggregations