use of artisynth.core.mechmodels.ExcitationComponent in project artisynth_core by artisynth.
the class ExcitationTargetAgent method selectionChanged.
public void selectionChanged(SelectionEvent e) {
ModelComponent c = e.getLastAddedComponent();
if (isValidTarget(c)) {
ExcitationComponent ex = (ExcitationComponent) c;
if (myState == State.SelectingExciters && ex != myExciter && myExciter.findTarget(ex) == -1) {
myExciter.addTarget(ex, 1.0);
DoubleField widget = createTargetWidget(ex, 1.0);
myTargetPanel.addWidget(widget);
myTargetPanel.mapWidgetToComponent(widget, ex);
myTargetPanel.revalidate();
myTargetPanel.repaint();
}
// else if (myExciter.findTarget(ex) != -1)
// { mySelectedTargets.add (ex);
// }
}
}
use of artisynth.core.mechmodels.ExcitationComponent in project artisynth_core by artisynth.
the class TrackingController method dispose.
/**
* Clears all terms and disposes storage
*/
public void dispose() {
System.out.println("tracking controller dispose()");
myMotionTerm = null;
myRegularizationTerm = null;
myBoundsTerm = null;
myCostFunction.dispose();
targetPoints.clear();
remove(targetPoints);
targetFrames.clear();
remove(targetFrames);
sourcePoints.clear();
remove(sourcePoints);
sourceFrames.clear();
remove(sourceFrames);
if (useMyExciters) {
myExciters.removeAllTargets();
remove(myExciters);
} else {
for (@SuppressWarnings("unused") ExcitationComponent excCom : exciters) {
}
exciters.clear();
remove(exciters);
}
excitationRegularizationWeights = null;
upperExcitationBounds.clear();
lowerExcitationBounds.clear();
}
use of artisynth.core.mechmodels.ExcitationComponent in project artisynth_core by artisynth.
the class ExcitationTargetAgent method actionPerformed.
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if (cmd.equals("Add")) {
mySelectionManager.clearSelections();
myMain.rerender();
setState(State.SelectingExciters);
} else if (cmd.equals("Stop")) {
mySelectionManager.clearSelections();
setState(State.Complete);
myMain.rerender();
} else if (cmd.equals("remove target")) {
JComponent[] widgets = myTargetPanel.getSelectedWidgets();
for (int i = 0; i < widgets.length; i++) {
ExcitationComponent target = (ExcitationComponent) myTargetPanel.getComponent(widgets[i]);
myExciter.removeTarget(target);
myTargetPanel.removeWidget(widgets[i]);
}
myTargetPanel.revalidate();
myTargetPanel.repaint();
} else {
super.actionPerformed(e);
}
}
use of artisynth.core.mechmodels.ExcitationComponent 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