Search in sources :

Example 6 with MobileBase

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();
}
Also used : Group(javafx.scene.Group) LinkConfiguration(com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration) LinkConfigurationWidget(com.neuronrobotics.bowlerstudio.creature.LinkConfigurationWidget) DHParameterKinematics(com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics) LinkSliderWidget(com.neuronrobotics.bowlerstudio.creature.LinkSliderWidget) Scene(javafx.scene.Scene) MobileBase(com.neuronrobotics.sdk.addons.kinematics.MobileBase) VBox(javafx.scene.layout.VBox)

Example 7 with MobileBase

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
        }
    });
}
Also used : BowlerAbstractDevice(com.neuronrobotics.sdk.common.BowlerAbstractDevice) CSG(eu.mihosoft.vrl.v3d.CSG) IDeviceConnectionEventListener(com.neuronrobotics.sdk.common.IDeviceConnectionEventListener) DHParameterKinematics(com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics) MobileBase(com.neuronrobotics.sdk.addons.kinematics.MobileBase)

Aggregations

MobileBase (com.neuronrobotics.sdk.addons.kinematics.MobileBase)7 IOException (java.io.IOException)4 DHParameterKinematics (com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics)3 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)3 InvalidRemoteException (org.eclipse.jgit.api.errors.InvalidRemoteException)3 TransportException (org.eclipse.jgit.api.errors.TransportException)3 CSG (eu.mihosoft.vrl.v3d.CSG)2 IssueReportingExceptionHandler (com.neuronrobotics.bowlerstudio.IssueReportingExceptionHandler)1 LinkConfigurationWidget (com.neuronrobotics.bowlerstudio.creature.LinkConfigurationWidget)1 LinkSliderWidget (com.neuronrobotics.bowlerstudio.creature.LinkSliderWidget)1 FileChangeWatcher (com.neuronrobotics.bowlerstudio.util.FileChangeWatcher)1 LinkConfiguration (com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration)1 BowlerAbstractDevice (com.neuronrobotics.sdk.common.BowlerAbstractDevice)1 IDeviceConnectionEventListener (com.neuronrobotics.sdk.common.IDeviceConnectionEventListener)1 IFileChangeListener (com.neuronrobotics.sdk.util.IFileChangeListener)1 File (java.io.File)1 WatchEvent (java.nio.file.WatchEvent)1 FXMLLoader (javafx.fxml.FXMLLoader)1 Group (javafx.scene.Group)1 Scene (javafx.scene.Scene)1