Search in sources :

Example 26 with Muscle

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

the class MuscleBundle method addFibre.

public Muscle addFibre(Point p0, Point p1, AxialMuscleMaterial mat) {
    Muscle fibre = new Muscle();
    fibre.setPoints(p0, p1);
    fibre.setRestLength(p0.distance(p1));
    fibre.setMaterial(mat);
    addFibre(fibre);
    return fibre;
}
Also used : Muscle(artisynth.core.mechmodels.Muscle) GenericMuscle(artisynth.core.materials.GenericMuscle)

Example 27 with Muscle

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

the class PointToPointMuscle method getMaxForce.

public double getMaxForce() {
    if (numActivations() < 1) {
        // no muscle
        return 0;
    }
    MuscleBundle bundle = getMuscleBundles().get(0);
    Muscle mus = bundle.getFibres().get(0);
    if (mus.getMaterial() instanceof AxialMuscleMaterial) {
        return ((AxialMuscleMaterial) mus.getMaterial()).getMaxForce();
    } else {
        return 0;
    }
}
Also used : AxialMuscleMaterial(artisynth.core.materials.AxialMuscleMaterial) Muscle(artisynth.core.mechmodels.Muscle)

Example 28 with Muscle

use of artisynth.core.mechmodels.Muscle 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)

Example 29 with Muscle

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

the class PointModel method addMuscle.

private Muscle addMuscle(Point p0, Point p1) {
    // Muscle m = Muscle.createLinear(muscleF, muscleMaxLen);
    Muscle m = new Muscle();
    // ConstantAxialMuscleMaterial mat = new ConstantAxialMuscleMaterial();
    LinearAxialMuscle mat = new LinearAxialMuscle();
    // PeckAxialMuscleMaterial mat = new PeckAxialMuscleMaterial();
    mat.setMaxForce(muscleF);
    mat.setMaxLength(muscleMaxLen);
    mat.setDamping(muscleD);
    mat.setOptLength(muscleOptLen);
    mat.setPassiveFraction(passiveFraction);
    mat.setForceScaling(muscleScaleFactor);
    m.setMaterial(mat);
    m.setRestLength(len);
    m.setFirstPoint(p0);
    m.setSecondPoint(p1);
    model.addAxialSpring(m);
    RenderProps.setLineColor(m, Color.RED);
    return m;
}
Also used : LinearAxialMuscle(artisynth.core.materials.LinearAxialMuscle) LinearAxialMuscle(artisynth.core.materials.LinearAxialMuscle) Muscle(artisynth.core.mechmodels.Muscle)

Example 30 with Muscle

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

the class PointModel method attach.

@Override
public void attach(DriverInterface driver) {
    super.attach(driver);
    if (getControlPanels().size() == 0) {
        ControlPanel panel = new ControlPanel("activations", "");
        for (AxialSpring s : model.axialSprings()) {
            if (s instanceof Muscle) {
                Muscle m = (Muscle) s;
                String name = (m.getName() == null ? "m" + m.getNumber() : m.getName().toUpperCase());
                panel.addWidget(name, m, "excitation", 0.0, 1.0);
            }
        }
        addControlPanel(panel);
    }
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) LinearAxialMuscle(artisynth.core.materials.LinearAxialMuscle) Muscle(artisynth.core.mechmodels.Muscle) AxialSpring(artisynth.core.mechmodels.AxialSpring)

Aggregations

Muscle (artisynth.core.mechmodels.Muscle)35 Point3d (maspack.matrix.Point3d)13 Point (artisynth.core.mechmodels.Point)10 ConstantAxialMuscle (artisynth.core.materials.ConstantAxialMuscle)9 AxialSpring (artisynth.core.mechmodels.AxialSpring)8 GenericMuscle (artisynth.core.materials.GenericMuscle)7 MuscleBundle (artisynth.core.femmodels.MuscleBundle)6 LinearAxialMuscle (artisynth.core.materials.LinearAxialMuscle)5 SimpleAxialMuscle (artisynth.core.materials.SimpleAxialMuscle)4 Particle (artisynth.core.mechmodels.Particle)4 RenderProps (maspack.render.RenderProps)4 FrameMarker (artisynth.core.mechmodels.FrameMarker)3 MuscleExciter (artisynth.core.mechmodels.MuscleExciter)3 Vector3d (maspack.matrix.Vector3d)3 FemMarker (artisynth.core.femmodels.FemMarker)2 ForceTarget (artisynth.core.inverse.ForceTarget)2 ForceTargetTerm (artisynth.core.inverse.ForceTargetTerm)2 TrackingController (artisynth.core.inverse.TrackingController)2 AxialMuscleMaterial (artisynth.core.materials.AxialMuscleMaterial)2 RigidBody (artisynth.core.mechmodels.RigidBody)2