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;
}
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;
}
}
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);
}
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;
}
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);
}
}
Aggregations