Search in sources :

Example 1 with MultiPointMuscle

use of artisynth.core.mechmodels.MultiPointMuscle in project artisynth_core by artisynth.

the class MultiMuscleDemo method build.

public void build(String[] args) {
    super.build(args);
    MechModel mechMod = (MechModel) models().get("mechMod");
    RigidBody block = mechMod.rigidBodies().get("block");
    Particle p0 = new Particle(0.1, 0, -size * 3, size / 2);
    p0.setDynamic(false);
    mechMod.addParticle(p0);
    Particle p1 = new Particle(0.1, 0, size * 3, size / 2);
    p1.setDynamic(false);
    mechMod.addParticle(p1);
    FrameMarker mkr0 = new FrameMarker();
    mechMod.addFrameMarker(mkr0, block, new Point3d(0, -size / 2, size / 2));
    FrameMarker mkr1 = new FrameMarker();
    mechMod.addFrameMarker(mkr1, block, new Point3d(0, size / 2, size / 2));
    MultiPointMuscle muscle = new MultiPointMuscle();
    LinearAxialMuscle mat = new LinearAxialMuscle();
    mat.setForceScaling(1);
    mat.setMaxForce(10);
    mat.setMaxLength(size);
    mat.setPassiveFraction(0.1);
    muscle.setMaterial(mat);
    muscle.addPoint(p0);
    muscle.addPoint(mkr0);
    muscle.addPoint(mkr1);
    muscle.addPoint(p1);
    mechMod.addMultiPointSpring(muscle);
    RenderProps.setLineColor(mechMod, Color.BLUE);
    RenderProps.setLineStyle(muscle, LineStyle.SPINDLE);
    RenderProps.setLineRadius(muscle, 0.1);
    RenderProps.setLineColor(muscle, Color.RED);
}
Also used : Particle(artisynth.core.mechmodels.Particle) LinearAxialMuscle(artisynth.core.materials.LinearAxialMuscle) MechModel(artisynth.core.mechmodels.MechModel) FrameMarker(artisynth.core.mechmodels.FrameMarker) Point3d(maspack.matrix.Point3d) RigidBody(artisynth.core.mechmodels.RigidBody) MultiPointMuscle(artisynth.core.mechmodels.MultiPointMuscle)

Example 2 with MultiPointMuscle

use of artisynth.core.mechmodels.MultiPointMuscle in project artisynth_core by artisynth.

the class TrackingController method addExciter.

/**
 * Adds an exciter to be used as a free variable in the inverse routine
 * @param weight regularization weight to be applied to the exciter
 * @param ex exciter to add
 * @param gain the gain applied to the exciter
 */
public void addExciter(double weight, ExcitationComponent ex, double gain) {
    if (useMyExciters) {
        myExciters.addTarget(ex, gain);
    } else {
        exciters.add(ex);
    }
    excitationRegularizationWeights.append(weight);
    if (ex instanceof MultiPointMuscle) {
        MultiPointMuscle m = (MultiPointMuscle) ex;
        if (m.getExcitationColor() == null) {
            RenderProps.setLineColor(m, Color.WHITE);
            m.setExcitationColor(Color.RED);
        }
    } else if (ex instanceof Muscle) {
        Muscle m = (Muscle) ex;
        if (m.getExcitationColor() == null) {
            RenderProps.setLineColor(m, Color.WHITE);
            m.setExcitationColor(Color.RED);
        }
    }
    /* add an element to the excitation bounds list for possible use later */
    upperExcitationBounds.add(null);
    lowerExcitationBounds.add(null);
}
Also used : MultiPointMuscle(artisynth.core.mechmodels.MultiPointMuscle) Muscle(artisynth.core.mechmodels.Muscle) MultiPointMuscle(artisynth.core.mechmodels.MultiPointMuscle)

Aggregations

MultiPointMuscle (artisynth.core.mechmodels.MultiPointMuscle)2 LinearAxialMuscle (artisynth.core.materials.LinearAxialMuscle)1 FrameMarker (artisynth.core.mechmodels.FrameMarker)1 MechModel (artisynth.core.mechmodels.MechModel)1 Muscle (artisynth.core.mechmodels.Muscle)1 Particle (artisynth.core.mechmodels.Particle)1 RigidBody (artisynth.core.mechmodels.RigidBody)1 Point3d (maspack.matrix.Point3d)1