use of com.neuronrobotics.sdk.addons.kinematics.MobileBase in project BowlerStudio by CommonWealthRobotics.
the class AppTestLinkWidgets method start.
@Override
public void start(Stage stage) throws Exception {
ScriptingEngine.gitScriptRun("https://github.com/CommonWealthRobotics/DeviceProviders.git", "loadAll.groovy", null);
MobileBase base = MobileBaseLoader.fromGit("https://github.com/Hephaestus-Arm/HephaestusArm2.git", "hephaestus.xml");
DHParameterKinematics limb = base.getAllDHChains().get(0);
int index = 2;
LinkConfiguration conf = limb.getLinkConfiguration(index);
LinkConfigurationWidget theWidget = new LinkConfigurationWidget(conf, limb.getFactory(), MobileBaseCadManager.get(base));
LinkSliderWidget lsw = new LinkSliderWidget(index, limb, theWidget);
VBox box = new VBox();
box.getChildren().addAll(lsw);
Group root = new Group(box);
Scene scene = new Scene(root, 800, 900);
stage.setTitle("My JavaFX Application");
stage.setScene(scene);
stage.show();
}
use of com.neuronrobotics.sdk.addons.kinematics.MobileBase in project BowlerStudio by CommonWealthRobotics.
the class AbstractBowlerStudioTab method setDevice.
public void setDevice(BowlerAbstractDevice pm) {
myNames = new ArrayList<>();
if (getMyNameSpaces().length > 0) {
for (int i = 0; i < getMyNameSpaces().length; i++) {
myNames.add(getMyNameSpaces()[i]);
}
if (!isMyNamespace(pm.getNamespaces())) {
throw new RuntimeException("Device and namespaces are incompatible ");
}
}
setOnCloseRequest(this);
initializeUI(pm);
pm.addConnectionEventListener(new IDeviceConnectionEventListener() {
@Override
public void onDisconnect(BowlerAbstractDevice source) {
// if the device disconnects, close the tab
if (source == pm && source != null) {
requestClose();
if (MobileBase.class.isInstance(pm)) {
MobileBase dev = (MobileBase) pm;
try {
for (CSG p : MobileBaseCadManager.get(dev).getBasetoCadMap().get(dev)) BowlerStudioController.removeObject(p);
for (DHParameterKinematics leg : dev.getAllDHChains()) for (CSG p : MobileBaseCadManager.get(dev).getDHtoCadMap().get(leg)) BowlerStudioController.removeObject(p);
} catch (Throwable e) {
}
}
} else {
// Not a bug, expected to ensure one device disconnects the rest of the dependent devices
// System.err.println("Device type was "+source.getClass()+" named "+source.getScriptingName()+" expected "+pm.getClass()+" named "+pm.getScriptingName());
// new Exception().printStackTrace();
}
}
@Override
public void onConnect(BowlerAbstractDevice source) {
// TODO Auto-generated method stub
}
});
}
Aggregations