Search in sources :

Example 16 with NumericInputProbe

use of artisynth.core.probes.NumericInputProbe in project artisynth_core by artisynth.

the class ForceTargetDemo method reloadTargetProbeData.

public void reloadTargetProbeData() throws IOException {
    ArtisynthPath.setWorkingDir(new File(ArtisynthPath.getSrcRelativePath(this, "data/ForceTargetDemo")));
    NumericInputProbe forceTargetProbe = (NumericInputProbe) getInputProbes().get("target forces");
    forceTargetProbe.setAttachedFileName("force_target.txt");
    forceTargetProbe.load();
    forceTargetProbe.setActive(true);
    NumericInputProbe motionTargetProbe = (NumericInputProbe) getInputProbes().get("target positions");
    motionTargetProbe.setAttachedFileName("motion_target.txt");
    motionTargetProbe.load();
    motionTargetProbe.setActive(true);
}
Also used : NumericInputProbe(artisynth.core.probes.NumericInputProbe) File(java.io.File)

Example 17 with NumericInputProbe

use of artisynth.core.probes.NumericInputProbe in project artisynth_core by artisynth.

the class FemMuscleArm method addProbes.

public void addProbes() {
    NumericInputProbe ip;
    NumericOutputProbe op;
    double rate = 0.01;
    try {
        ip = new NumericInputProbe(model, "models/muscle:excitation", 0, 2.0);
        ip.addData(new double[] { 0, 0, 1, 0.5, 2, 0 }, NumericInputProbe.EXPLICIT_TIME);
        ip.setName("Muscle Activation");
        addInputProbe(ip);
        op = new NumericOutputProbe(model, "frameMarkers/endPoint:displacement", 0, 2, -1);
        op.setName("End Point Displacement");
        addOutputProbe(op);
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}
Also used : NumericInputProbe(artisynth.core.probes.NumericInputProbe) NumericOutputProbe(artisynth.core.probes.NumericOutputProbe) IOException(java.io.IOException)

Example 18 with NumericInputProbe

use of artisynth.core.probes.NumericInputProbe in project artisynth_core by artisynth.

the class FemMuscleDemo method addProbes.

protected void addProbes(FemMuscleModel fem) {
    try {
        String[] exciters;
        if (addMidMuscle) {
            exciters = new String[] { "bundles/0:excitation", "bundles/1:excitation", "bundles/2:excitation" };
        } else {
            exciters = new String[] { "bundles/0:excitation", "bundles/1:excitation" };
        }
        NumericInputProbe inprobe = new NumericInputProbe(fem, exciters, 0, 5);
        if (addMidMuscle) {
            inprobe.addData(new double[] { 0, 0, 0, 0, 2.5, 0.1, 0, 0.1, 3.5, 0, 0, 0, 5, 0, 0, 0 }, NumericInputProbe.EXPLICIT_TIME);
        } else {
            inprobe.addData(new double[] { 0, 0, 0, 2.5, 0.1, 0, 3.5, 0, 0, 5, 0, 0 }, NumericInputProbe.EXPLICIT_TIME);
        }
        addInputProbe(inprobe);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : NumericInputProbe(artisynth.core.probes.NumericInputProbe) IOException(java.io.IOException)

Example 19 with NumericInputProbe

use of artisynth.core.probes.NumericInputProbe in project artisynth_core by artisynth.

the class CoupledSolveDemo method build.

public void build(String[] args) {
    MechModel mechMod = new MechModel("mechModel");
    mechMod.setPenetrationTol(1e-5);
    mechMod.setMaxStepSize(0.01);
    mechMod.setIntegrator(Integrator.ConstrainedBackwardEuler);
    addModel(mechMod);
    // add the FemMod
    addFemModel();
    addCollider();
    NumericInputProbe probe = new NumericInputProbe(collider, "position", 0, 5.0);
    probe.addData(new double[] { 0.0, 0, 0, 0.05, 1.0, 0, 0, 0.01, 1.5, 0, 0, 0.05, 2.5, 0, 0, 0.01, 3.0, 0, 0, 0.01, 3.5, 0, 0, 0.05, 4.5, 0, 0, 0.01, 5.0, 0, 0, 0.05 }, NumericInputProbe.EXPLICIT_TIME);
    addInputProbe(probe);
    probe = new NumericInputProbe(collider, "velocity", 0, 5.0);
    probe.addData(new double[] { 0.0, 0, 0, -0.04, 0, 0, 0, 1.0, 0, 0, 0.08, 0, 0, 0, 1.5, 0, 0, -0.04, 0, 0, 0, 2.5, 0, 0, 0.00, 0, 0, 0, 3.0, 0, 0, 0.08, 0, 0, 0, 3.5, 0, 0, -0.04, 0, 0, 0, 4.5, 0, 0, 0.08, 0, 0, 0, 5.0, 0, 0, 0.00, 0, 0, 0 }, NumericInputProbe.EXPLICIT_TIME);
    probe.setInterpolationOrder(Interpolation.Order.Step);
    addInputProbe(probe);
    addBreakPoint(2.5);
    probe.setActive(true);
}
Also used : NumericInputProbe(artisynth.core.probes.NumericInputProbe)

Aggregations

NumericInputProbe (artisynth.core.probes.NumericInputProbe)19 NumericOutputProbe (artisynth.core.probes.NumericOutputProbe)9 IOException (java.io.IOException)8 Property (maspack.properties.Property)5 File (java.io.File)4 ArrayList (java.util.ArrayList)3 ModelComponent (artisynth.core.modelbase.ModelComponent)2 WayPoint (artisynth.core.probes.WayPoint)2 ControlPanel (artisynth.core.gui.ControlPanel)1 Displayable (artisynth.core.gui.Displayable)1 AddComponentsCommand (artisynth.core.gui.editorManager.AddComponentsCommand)1 InputNumericProbeEditor (artisynth.core.gui.probeEditor.InputNumericProbeEditor)1 NumericProbeEditor (artisynth.core.gui.probeEditor.NumericProbeEditor)1 OutputNumericProbeEditor (artisynth.core.gui.probeEditor.OutputNumericProbeEditor)1 TargetPoint (artisynth.core.inverse.TargetPoint)1 CollisionManager (artisynth.core.mechmodels.CollisionManager)1 Frame (artisynth.core.mechmodels.Frame)1 MechModel (artisynth.core.mechmodels.MechModel)1 Point (artisynth.core.mechmodels.Point)1 NumericProbeBase (artisynth.core.probes.NumericProbeBase)1