Search in sources :

Example 11 with DHParameterKinematics

use of com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics in project BowlerStudio by CommonWealthRobotics.

the class ParallelWidget method configure.

public void configure(MobileBase b, DHParameterKinematics dh, CreatureLab creatureLab) {
    resetting = true;
    this.base = b;
    this.dh = dh;
    this.creatureLab = creatureLab;
    System.out.println("Configuring arm " + dh.getScriptingName());
    robotToFiducialTransform = new TransformNR();
    Platform.runLater(() -> groupName.setText(""));
    Platform.runLater(() -> relativeName.getItems().clear());
    Platform.runLater(() -> relIndex.getItems().clear());
    Platform.runLater(() -> relIndex.setDisable(true));
    Platform.runLater(() -> e.setDisable(true));
    if (getGroup() == null) {
        useParallel.setSelected(false);
        box.setDisable(true);
    } else {
        useParallel.setSelected(true);
        box.setDisable(false);
        Platform.runLater(() -> groupName.setText(getGroup().getNameOfParallelGroup()));
        for (DHParameterKinematics l : base.getAllDHChains()) {
            if (!l.getScriptingName().contentEquals(dh.getScriptingName())) {
                System.out.println("Adding Option " + l.getScriptingName());
                Platform.runLater(() -> relativeName.getItems().add(l.getScriptingName()));
            }
        }
        if (getGroup().getTipOffset(dh) != null) {
            Platform.runLater(() -> useRelative.setSelected(true));
            Platform.runLater(() -> relativeToControls.setDisable(false));
            Platform.runLater(() -> relIndex.setDisable(false));
            Platform.runLater(() -> e.setDisable(false));
            robotToFiducialTransform = getGroup().getTipOffset(dh);
            Platform.runLater(() -> e.updatePose(robotToFiducialTransform));
            String refLimbName = getGroup().getTipOffsetRelativeName(dh);
            setNewReferencedLimb(base, refLimbName);
            Platform.runLater(() -> relativeName.setValue(refLimbName));
            Platform.runLater(() -> relIndex.setValue(getGroup().getTipOffsetRelativeIndex(dh)));
        } else {
            Platform.runLater(() -> useRelative.setSelected(false));
            Platform.runLater(() -> relativeToControls.setDisable(true));
        }
    }
    e.updatePose(robotToFiducialTransform);
    Platform.runLater(() -> resetting = false);
    home();
}
Also used : TransformNR(com.neuronrobotics.sdk.addons.kinematics.math.TransformNR) DHParameterKinematics(com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics)

Example 12 with DHParameterKinematics

use of com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics in project BowlerStudio by CommonWealthRobotics.

the class ParallelWidget method setNewReferencedLimb.

private void setNewReferencedLimb(MobileBase base, String refLimbName) {
    DHParameterKinematics referencedLimb = null;
    for (DHParameterKinematics lm : base.getAllDHChains()) {
        if (lm.getScriptingName().toLowerCase().contentEquals(refLimbName.toLowerCase())) {
            // FOund the referenced limb
            referencedLimb = lm;
        }
    }
    Platform.runLater(() -> relIndex.getItems().clear());
    DHParameterKinematics rl = referencedLimb;
    Platform.runLater(() -> {
        for (int i = 0; i < rl.getNumberOfLinks(); i++) {
            relIndex.getItems().add(i);
        }
    });
}
Also used : DHParameterKinematics(com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics)

Example 13 with DHParameterKinematics

use of com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics 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

DHParameterKinematics (com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics)13 CSG (eu.mihosoft.vrl.v3d.CSG)4 IOException (java.io.IOException)4 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)4 InvalidRemoteException (org.eclipse.jgit.api.errors.InvalidRemoteException)4 TransportException (org.eclipse.jgit.api.errors.TransportException)4 LinkConfiguration (com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration)3 MobileBase (com.neuronrobotics.sdk.addons.kinematics.MobileBase)3 IssueReportingExceptionHandler (com.neuronrobotics.bowlerstudio.IssueReportingExceptionHandler)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Group (javafx.scene.Group)2 VBox (javafx.scene.layout.VBox)2 LinkConfigurationWidget (com.neuronrobotics.bowlerstudio.creature.LinkConfigurationWidget)1 LinkSliderWidget (com.neuronrobotics.bowlerstudio.creature.LinkSliderWidget)1 AbstractLink (com.neuronrobotics.sdk.addons.kinematics.AbstractLink)1 DHLink (com.neuronrobotics.sdk.addons.kinematics.DHLink)1 ILinkListener (com.neuronrobotics.sdk.addons.kinematics.ILinkListener)1 TransformNR (com.neuronrobotics.sdk.addons.kinematics.math.TransformNR)1 BowlerAbstractDevice (com.neuronrobotics.sdk.common.BowlerAbstractDevice)1