use of artisynth.core.inverse.ForceTarget 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();
}
use of artisynth.core.inverse.ForceTarget 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);
}
Aggregations