use of artisynth.core.inverse.TrackingController in project artisynth_core by artisynth.
the class TrackingControllerEditor method addActions.
public void addActions(EditActionMap actions, SelectionManager selManager) {
LinkedList<ModelComponent> selection = selManager.getCurrentSelection();
if (containsSingleSelection(selection, TrackingController.class)) {
TrackingController controller = (TrackingController) selection.get(0);
actions.add(this, "Edit tracking targets ...", EXCLUSIVE);
// XXX currently editing muscles through
MechSystemBase mech = controller.getMech();
if (mech.getClass() == MechModel.class) {
actions.add(this, "Edit muscles ...", EXCLUSIVE);
}
}
}
use of artisynth.core.inverse.TrackingController 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.TrackingController in project artisynth_core by artisynth.
the class TrackingControllerEditor method applyAction.
public void applyAction(String actionCommand, LinkedList<ModelComponent> selection, Rectangle popupBounds) {
if (containsSingleSelection(selection, TrackingController.class)) {
TrackingController controller = (TrackingController) selection.get(0);
if (actionCommand == "Edit tracking targets ...") {
if (myEditManager.acquireEditLock()) {
MotionTargetComponentAgent agent = new MotionTargetComponentAgent(myMain, controller);
agent.show(popupBounds);
}
} else if (actionCommand == "Edit muscles ...") {
if (myEditManager.acquireEditLock()) {
ExcitationTargetAgent agent = new ExcitationTargetAgent(myMain, controller.getMuscleExciter());
agent.show(popupBounds);
}
}
}
}
use of artisynth.core.inverse.TrackingController in project artisynth_core by artisynth.
the class FemSurfaceTargetDemo method addTrackingController.
public void addTrackingController() {
TrackingController tcon = new TrackingController(mech, "tcon");
for (FemNode n : fem.getNodes()) {
if (n.getPosition().x < -l / 2 + eps) {
tcon.addMotionTarget(n);
RenderProps.setAlpha(n, 0.5);
}
}
for (MuscleBundle b : fem.getMuscleBundles()) {
tcon.addExciter(b);
}
// project reference points to body
addController(new SurfaceTargetController(body.getMesh(), tcon.getMotionSources(), tcon.getTargetPoints()));
for (TargetPoint p : tcon.getTargetPoints()) {
RenderProps.setPointRadius(p, l / 100);
}
tcon.addL2RegularizationTerm(0.1);
tcon.setProbeDuration(10);
tcon.createProbesAndPanel(this);
addController(tcon);
}
use of artisynth.core.inverse.TrackingController in project artisynth_core by artisynth.
the class HydrostatInvDemo method addInverseController.
protected void addInverseController() {
trackingController = new TrackingController(mech, "tcon");
for (ModelComponent comp : hydro.createTargetList()) {
trackingController.addMotionTarget((MotionTargetComponent) comp);
}
if (useBundlesForInverse) {
for (MuscleBundle b : hydro.getMuscleBundles()) {
trackingController.addExciter(b);
Color exColor = b.getRenderProps().getLineColor();
b.setExcitationColor(exColor);
RenderProps.setLineColor(b, Color.WHITE);
}
} else {
for (ExcitationComponent exciter : hydro.getMuscleExciters()) {
trackingController.addExciter(exciter);
}
}
trackingController.addL2RegularizationTerm(100 * 100);
trackingController.setProbeDuration(5.0);
trackingController.setProbeUpdateInterval(stepsize);
trackingController.createProbesAndPanel(this);
addController(trackingController);
}
Aggregations