use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class PointModel method add2dLabeledMuscles.
public void add2dLabeledMuscles(String[] labels) {
double[] muscleFs;
double muscleFmult;
if (applyDisturbance) {
muscleFs = new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
muscleFmult = 100;
} else {
muscleFs = new double[] { 5, 1, 2, 1, 5, 1, 2, 1, 5, 1, 2, 1, 5, 1, 2, 1 };
muscleFmult = 10;
}
addMuscles(new RigidTransform3d(), labels.length, 0.0);
int i = 0;
for (AxialSpring s : model.axialSprings()) {
if (s instanceof Muscle) {
s.setName(labels[i]);
// ((Muscle) s).setMaxForce(muscleFmult * muscleFs[i]);
// RenderProps.setLineRadius(s, 0.1 * muscleFs[i]);
i += 1;
}
}
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class PointModel method addTrackingController.
public void addTrackingController() {
TrackingController myTrackingController = new TrackingController(model, "tcon");
for (AxialSpring s : model.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));
MotionTargetComponent target = myTrackingController.addMotionTarget(center);
RenderProps.setPointRadius((Renderable) target, 0.525);
if (useReactionForceTargetP) {
ForceTargetTerm forceTerm = new ForceTargetTerm(myTrackingController);
ForceTarget ft = forceTerm.addForceTarget(model.bodyConnectors().get("center_constraint"));
ft.setArrowSize(2);
RenderProps.setLineStyle(ft, LineStyle.CYLINDER);
RenderProps.setLineRadius(ft, 0.25);
forceTerm.setWeight(1d);
myTrackingController.addForceTargetTerm(forceTerm);
}
// myTrackingController.getSolver().setBounds(0.01, 0.99);
myTrackingController.createProbesAndPanel(this);
addController(myTrackingController);
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class PointModel1d method setProperties.
public void setProperties() {
double springK = 100.0;
double passiveFraction = 0.5;
double muscleD = 0.0;
double pointDamping = 0.1;
for (AxialSpring s : model.axialSprings()) {
if (s instanceof AxialSpring) {
if (s.getMaterial() instanceof LinearAxialMaterial) {
LinearAxialMaterial mat = (LinearAxialMaterial) s.getMaterial().clone();
mat.setStiffness(springK);
s.setMaterial(mat);
}
}
if (s instanceof Muscle) {
Muscle m = (Muscle) s;
if (m.getMaterial() instanceof AxialMuscleMaterial) {
AxialMuscleMaterial mat = (AxialMuscleMaterial) m.getMaterial().clone();
mat.setPassiveFraction(passiveFraction);
mat.setDamping(muscleD);
m.setMaterial(mat);
}
}
}
for (Particle p : model.particles()) {
p.setPointDamping(pointDamping);
}
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class PointModel2d method addTrackingController.
public void addTrackingController() {
super.addTrackingController();
for (AxialSpring s : model.axialSprings()) {
if (s instanceof Muscle) {
((Muscle) s).setExcitationColor(Color.RED);
RenderProps.setLineColor(s, new Color(0, 0, 219));
}
}
model.setMaxColoredExcitation(0.1);
}
use of artisynth.core.mechmodels.Muscle in project artisynth_core by artisynth.
the class HydrostatModel method createMuscles.
public void createMuscles(Axis axis, MuscleBundle bundle) {
RenderProps.setLineWidth(bundle, 4);
Point3d p0 = new Point3d();
Point3d p1 = new Point3d();
for (double i = 0; i < (axis == Axis.X ? nl : nl + 1); i++) for (double j = 0; j < (axis == Axis.Y ? nr : nr + 1); j++) for (double k = 0; k < (axis == Axis.Z ? nr : nr + 1); k++) {
if (periphLongP && axis == Axis.X && ((j != 0 && j != nr) && (k != 0 && k != nr)))
continue;
p0.set(l * (i / nl - 0.5), r * (j / nr - 0.5), r * (k / nr - 0.5));
p1.set(l * ((axis == Axis.X ? i + 1 : i) / (nl) - 0.5), r * ((axis == Axis.Y ? j + 1 : j) / nr - 0.5), r * ((axis == Axis.Z ? k + 1 : k) / nr - 0.5));
Muscle f = new Muscle(findPoint(p0), findPoint(p1));
f.setConstantMuscleMaterial(muscleForce, 1);
bundle.addFibre(f);
}
}
Aggregations