Search in sources :

Example 1 with TrackingController

use of artisynth.core.inverse.TrackingController in project artisynth_core by artisynth.

the class TrackingControllerEditor method addActions.

public void addActions(EditActionMap actions, SelectionManager selManager) {
    LinkedList<ModelComponent> selection = selManager.getCurrentSelection();
    if (containsSingleSelection(selection, TrackingController.class)) {
        TrackingController controller = (TrackingController) selection.get(0);
        actions.add(this, "Edit tracking targets ...", EXCLUSIVE);
        // XXX currently editing muscles through
        MechSystemBase mech = controller.getMech();
        if (mech.getClass() == MechModel.class) {
            actions.add(this, "Edit muscles ...", EXCLUSIVE);
        }
    }
}
Also used : MechSystemBase(artisynth.core.mechmodels.MechSystemBase) TrackingController(artisynth.core.inverse.TrackingController)

Example 2 with TrackingController

use of artisynth.core.inverse.TrackingController in project artisynth_core by artisynth.

the class ForceTargetDemo method addTrackingController.

public void addTrackingController(FrameMarker mkr) throws IOException {
    TrackingController myTrackingController = new TrackingController(mech, "tcon");
    for (AxialSpring s : mech.axialSprings()) {
        if (s instanceof Muscle) {
            myTrackingController.addExciter((Muscle) s);
        }
    }
    // myTrackingController.addTerm(new StiffnessTerm(model, center));
    // StiffnessTerm kTerm = TrackingController.addStiffnessTarget(center, new int[]{0,2});
    // kTerm.setStiffnessTargetType(StiffnessTargetType.DIAG);
    // ComplianceTerm2d cterm = new ComplianceTerm2d(TrackingController, center, new int[]{0,2});
    // cterm.setComplianceTargetType(StiffnessTargetType.DIAG);
    // TrackingController.addTerm(cterm);
    myTrackingController.addL2RegularizationTerm();
    // myTrackingController.addTerm(new DampingTerm(TrackingController));
    // myTrackingController.addTerm(new StaticMotionTargetTerm(TrackingController));
    myTrackingController.addMotionTarget(mkr);
    setPointRenderProps((TargetPoint) myTrackingController.getMotionTargets().get(0));
    ForceTargetTerm mft = new ForceTargetTerm(myTrackingController);
    // mft.addMotionTarget(mkr);
    // setPointRenderProps((TargetPoint) mft.getMotionTargets ().get (0));
    double[] lam = { -3.5 };
    VectorNd tarlam = new VectorNd(lam);
    if (cons == true) {
        ForceTarget ft = mft.addForceTarget(con);
        ft.setTargetLambda(tarlam);
    }
    if (two_cons == true) {
        ForceTarget ft = mft.addForceTarget(con2);
        ft.setTargetLambda(tarlam);
    }
    if (force == true) {
        myTrackingController.addForceTargetTerm(mft);
    }
    // myTrackingController.getSolver().setBounds(0.01, 0.99);
    // setWorkingDir();
    // loadForceInputProbe(mft);
    myTrackingController.setProbeDuration(10.0);
    myTrackingController.createProbesAndPanel(this);
    addController(myTrackingController);
    reloadTargetProbeData();
}
Also used : VectorNd(maspack.matrix.VectorNd) SimpleAxialMuscle(artisynth.core.materials.SimpleAxialMuscle) Muscle(artisynth.core.mechmodels.Muscle) ForceTargetTerm(artisynth.core.inverse.ForceTargetTerm) ForceTarget(artisynth.core.inverse.ForceTarget) AxialSpring(artisynth.core.mechmodels.AxialSpring) TrackingController(artisynth.core.inverse.TrackingController)

Example 3 with TrackingController

use of artisynth.core.inverse.TrackingController in project artisynth_core by artisynth.

the class TrackingControllerEditor method applyAction.

public void applyAction(String actionCommand, LinkedList<ModelComponent> selection, Rectangle popupBounds) {
    if (containsSingleSelection(selection, TrackingController.class)) {
        TrackingController controller = (TrackingController) selection.get(0);
        if (actionCommand == "Edit tracking targets ...") {
            if (myEditManager.acquireEditLock()) {
                MotionTargetComponentAgent agent = new MotionTargetComponentAgent(myMain, controller);
                agent.show(popupBounds);
            }
        } else if (actionCommand == "Edit muscles ...") {
            if (myEditManager.acquireEditLock()) {
                ExcitationTargetAgent agent = new ExcitationTargetAgent(myMain, controller.getMuscleExciter());
                agent.show(popupBounds);
            }
        }
    }
}
Also used : TrackingController(artisynth.core.inverse.TrackingController)

Example 4 with TrackingController

use of artisynth.core.inverse.TrackingController in project artisynth_core by artisynth.

the class FemSurfaceTargetDemo method addTrackingController.

public void addTrackingController() {
    TrackingController tcon = new TrackingController(mech, "tcon");
    for (FemNode n : fem.getNodes()) {
        if (n.getPosition().x < -l / 2 + eps) {
            tcon.addMotionTarget(n);
            RenderProps.setAlpha(n, 0.5);
        }
    }
    for (MuscleBundle b : fem.getMuscleBundles()) {
        tcon.addExciter(b);
    }
    // project reference points to body
    addController(new SurfaceTargetController(body.getMesh(), tcon.getMotionSources(), tcon.getTargetPoints()));
    for (TargetPoint p : tcon.getTargetPoints()) {
        RenderProps.setPointRadius(p, l / 100);
    }
    tcon.addL2RegularizationTerm(0.1);
    tcon.setProbeDuration(10);
    tcon.createProbesAndPanel(this);
    addController(tcon);
}
Also used : FemNode(artisynth.core.femmodels.FemNode) MuscleBundle(artisynth.core.femmodels.MuscleBundle) TargetPoint(artisynth.core.inverse.TargetPoint) TrackingController(artisynth.core.inverse.TrackingController)

Example 5 with TrackingController

use of artisynth.core.inverse.TrackingController in project artisynth_core by artisynth.

the class HydrostatInvDemo method addInverseController.

protected void addInverseController() {
    trackingController = new TrackingController(mech, "tcon");
    for (ModelComponent comp : hydro.createTargetList()) {
        trackingController.addMotionTarget((MotionTargetComponent) comp);
    }
    if (useBundlesForInverse) {
        for (MuscleBundle b : hydro.getMuscleBundles()) {
            trackingController.addExciter(b);
            Color exColor = b.getRenderProps().getLineColor();
            b.setExcitationColor(exColor);
            RenderProps.setLineColor(b, Color.WHITE);
        }
    } else {
        for (ExcitationComponent exciter : hydro.getMuscleExciters()) {
            trackingController.addExciter(exciter);
        }
    }
    trackingController.addL2RegularizationTerm(100 * 100);
    trackingController.setProbeDuration(5.0);
    trackingController.setProbeUpdateInterval(stepsize);
    trackingController.createProbesAndPanel(this);
    addController(trackingController);
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) ModelComponent(artisynth.core.modelbase.ModelComponent) Color(java.awt.Color) ExcitationComponent(artisynth.core.mechmodels.ExcitationComponent) TrackingController(artisynth.core.inverse.TrackingController)

Aggregations

TrackingController (artisynth.core.inverse.TrackingController)6 MuscleBundle (artisynth.core.femmodels.MuscleBundle)2 ForceTarget (artisynth.core.inverse.ForceTarget)2 ForceTargetTerm (artisynth.core.inverse.ForceTargetTerm)2 AxialSpring (artisynth.core.mechmodels.AxialSpring)2 Muscle (artisynth.core.mechmodels.Muscle)2 FemNode (artisynth.core.femmodels.FemNode)1 TargetPoint (artisynth.core.inverse.TargetPoint)1 LinearAxialMuscle (artisynth.core.materials.LinearAxialMuscle)1 SimpleAxialMuscle (artisynth.core.materials.SimpleAxialMuscle)1 ExcitationComponent (artisynth.core.mechmodels.ExcitationComponent)1 MechSystemBase (artisynth.core.mechmodels.MechSystemBase)1 MotionTargetComponent (artisynth.core.mechmodels.MotionTargetComponent)1 ModelComponent (artisynth.core.modelbase.ModelComponent)1 Color (java.awt.Color)1 VectorNd (maspack.matrix.VectorNd)1