use of com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics in project BowlerStudio by CommonWealthRobotics.
the class ParallelWidget method setupAddReferenceSection.
private void setupAddReferenceSection() {
base.getParallelGroup(groupName.getText()).setupReferencedLimbStartup(dh, null, "", 0);
Platform.runLater(() -> relativeName.getItems().clear());
for (DHParameterKinematics l : base.getAllDHChains()) {
if (!l.getScriptingName().contentEquals(dh.getScriptingName())) {
Platform.runLater(() -> relativeName.getItems().add(l.getScriptingName()));
}
}
relIndex.setDisable(true);
e.setDisable(true);
}
use of com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics in project BowlerStudio by CommonWealthRobotics.
the class CreatureLab method finishLoading.
private void finishLoading(MobileBase device) {
TreeView<String> tree = null;
TreeItem<String> rootItem = null;
TreeItem<String> mainBase = null;
int count = 1;
for (DHParameterKinematics kin : device.getAllDHChains()) {
for (int i = 0; i < kin.getNumberOfLinks(); i++) {
DHLink dhLink = kin.getDhLink(i);
if (dhLink.getSlaveMobileBase() != null) {
count++;
}
}
}
try {
rootItem = new TreeItem<String>("Mobile Bases", AssetFactory.loadIcon("creature.png"));
mainBase = new TreeItem<String>(device.getScriptingName(), AssetFactory.loadIcon("creature.png"));
} catch (Exception e) {
rootItem = new TreeItem<String>(device.getScriptingName());
}
if (count == 1) {
rootItem = mainBase;
} else {
rootItem.getChildren().add(mainBase);
}
tree = new TreeView<>(rootItem);
AnchorPane treebox1 = tab.getTreeBox();
treebox1.getChildren().clear();
treebox1.getChildren().add(tree);
AnchorPane.setTopAnchor(tree, 0.0);
AnchorPane.setLeftAnchor(tree, 0.0);
AnchorPane.setRightAnchor(tree, 0.0);
AnchorPane.setBottomAnchor(tree, 0.0);
HashMap<TreeItem<String>, Runnable> callbackMapForTreeitems = new HashMap<>();
HashMap<TreeItem<String>, Group> widgetMapForTreeitems = new HashMap<>();
File source;
boolean creatureIsOwnedByUser = false;
try {
source = ScriptingEngine.fileFromGit(device.getGitSelfSource()[0], device.getGitSelfSource()[1]);
creatureIsOwnedByUser = ScriptingEngine.checkOwner(source);
} catch (GitAPIException | IOException e) {
// TODO Auto-generated catch block
new IssueReportingExceptionHandler().uncaughtException(Thread.currentThread(), e);
}
rootItem.setExpanded(true);
MobileBaseCadManager.get(device, BowlerStudioController.getMobileBaseUI());
MobleBaseMenueFactory.load(device, tree, mainBase, callbackMapForTreeitems, widgetMapForTreeitems, this, true, creatureIsOwnedByUser);
for (DHParameterKinematics kin : device.getAllDHChains()) {
for (int i = 0; i < kin.getNumberOfLinks(); i++) {
DHLink dhLink = kin.getDhLink(i);
String linkName = kin.getLinkConfiguration(i).getName();
if (dhLink.getSlaveMobileBase() != null) {
TreeItem<String> mobile = new TreeItem<>(kin.getScriptingName() + " ->\n " + linkName + " link " + i + " ->\n " + dhLink.getSlaveMobileBase().getScriptingName(), AssetFactory.loadIcon("creature.png"));
MobleBaseMenueFactory.load(dhLink.getSlaveMobileBase(), tree, mobile, callbackMapForTreeitems, widgetMapForTreeitems, this, false, creatureIsOwnedByUser);
rootItem.getChildren().add(mobile);
}
}
}
tree.setPrefWidth(325);
tree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
JogMobileBase walkWidget = new JogMobileBase(device);
tree.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
@Override
public void changed(ObservableValue<?> observable, Object oldValue, Object newValue) {
@SuppressWarnings("unchecked") TreeItem<String> treeItem = (TreeItem<String>) newValue;
new Thread() {
public void run() {
if (callbackMapForTreeitems.get(treeItem) != null) {
callbackMapForTreeitems.get(treeItem).run();
}
if (widgetMapForTreeitems.get(treeItem) != null) {
Platform.runLater(() -> {
tab.getControlsBox().getChildren().clear();
Group g = widgetMapForTreeitems.get(treeItem);
tab.getControlsBox().getChildren().add(g);
AnchorPane.setTopAnchor(g, 0.0);
AnchorPane.setLeftAnchor(g, 0.0);
AnchorPane.setRightAnchor(g, 0.0);
AnchorPane.setBottomAnchor(g, 0.0);
});
} else {
Platform.runLater(() -> {
tab.getControlsBox().getChildren().clear();
});
}
}
}.start();
}
});
VBox progress = new VBox(10);
final ToggleGroup group = new ToggleGroup();
RadioButton rb1 = new RadioButton();
rb1.setToggleGroup(group);
rb1.setSelected(true);
rb1.setOnAction(event -> {
setCadMode(false);
});
RadioButton rb2 = new RadioButton();
rb2.setToggleGroup(group);
rb2.fire();
rb2.setOnAction(event -> {
setCadMode(true);
});
HBox radioOptions = new HBox(10);
radioOptions.getChildren().addAll(new Label("Cad"), rb1, rb2, new Label("Config"));
pi = new ProgressIndicator(0);
baseManager = MobileBaseCadManager.get(device, BowlerStudioController.getMobileBaseUI());
pi.progressProperty().bindBidirectional(baseManager.getProcesIndictor());
HBox progressIndicatorPanel = new HBox(10);
progressIndicatorPanel.getChildren().addAll(new Label("Cad Progress:"), pi);
progress.getChildren().addAll(progressIndicatorPanel, autoRegen, radioOptions);
progress.setStyle("-fx-background-color: #FFFFFF;");
progress.setOpacity(.7);
progress.setMinHeight(100);
progress.setPrefSize(325, 150);
tab.setOverlayTop(progress);
tab.setOverlayTopRight(walkWidget);
BowlerStudioModularFrame.getBowlerStudioModularFrame().showCreatureLab();
// start the UI in config mode
setCadMode(true);
generateCad();
setContent(root);
}
use of com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics in project java-bowler by NeuronRobotics.
the class Jfx3dManager method attachArm.
public void attachArm(DyIO master, String xml) {
for (int i = 0; i < master.getPIDChannelCount(); i++) {
// disable PID controller, default PID and dypid configurations are
// disabled.
master.ConfigureDynamicPIDChannels(new DyPIDConfiguration(i));
master.ConfigurePIDController(new PIDConfiguration());
}
attachArm(new DHParameterKinematics(master, xml));
}
use of com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics in project java-bowler by NeuronRobotics.
the class DHKinematicsViewer method main.
public static void main(String[] args) {
System.setProperty("prism.dirtyopts", "false");
JFrame frame = new JFrame();
DyIO.disableFWCheck();
// Log.enableInfoPrint();
// Create the references for my known DyIOs
DyIO master = new DyIO(ConnectionDialog.promptConnection());
master.connect();
if (master.isAvailable()) {
DHParameterKinematics model = new DHParameterKinematics(master, "TrobotMaster.xml");
frame.setContentPane(new DHKinematicsViewer(model));
frame.setSize(1024, 1024);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
Log.enableSystemPrint(false);
while (true) {
ThreadUtil.wait(1);
master.getAllChannelValues();
}
}
use of com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics in project bowler-script-kernel by CommonWealthRobotics.
the class MobileBaseCadManager method set.
private void set(MobileBase base, int limb, int link) {
ArrayList<DHParameterKinematics> limbs = base.getAllDHChains();
double numLimbs = limbs.size();
DHParameterKinematics dh = limbs.get(limb);
double partsTotal = numLimbs * dh.getNumberOfLinks();
double progress = ((double) ((limb * dh.getNumberOfLinks()) + link)) / partsTotal;
// System.out.println("Cad progress " + progress + " limb " + limb + " link " + link + " total parts " + partsTotal);
getProcesIndictor().set(0.333 + (2 * (progress / 3)));
}
Aggregations