use of com.neuronrobotics.sdk.addons.kinematics.IRegistrationListenerNR in project java-bowler by NeuronRobotics.
the class SampleGuiNR method populate.
private void populate() {
removeAll();
setHomeAll(new JButton("Home All"));
getHomeAll().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new Thread() {
public void run() {
setName("Bowler Platform Homing thread");
getModel().homeAllLinks();
getHomeAll().setText("Homed");
setButtonEnabled(true);
}
}.start();
getHomeAll().setText("Homing...");
setButtonEnabled(false);
}
});
estop.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
model.emergencyStop();
}
});
for (int i = 0; i < model.getNumberOfLinks(); i++) {
SampleGuiAxisWidgetNR w = new SampleGuiAxisWidgetNR(i, model);
links.add(w, "wrap");
axis.add(w);
}
setRas(new MatrixDisplayNR("Global to Base"));
getRas().setEditable(true);
getRas().setTransform(getModel().getFiducialToGlobalTransform());
getRas().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
TransformNR m = new TransformNR(new Matrix(getRas().getTableData()));
System.out.println("Setting ras transform: " + m);
getModel().setGlobalToFiducialTransform(m);
}
});
getModel().addRegistrationListener(new IRegistrationListenerNR() {
public void onFiducialToGlobalUpdate(AbstractKinematicsNR source, TransformNR registration) {
getRas().setTransform(registration);
}
public void onBaseToFiducialUpdate(AbstractKinematicsNR source, TransformNR registration) {
}
});
setRobReg(new MatrixDisplayNR("Base to Robot"));
getRobReg().setEditable(true);
getRobReg().setTransform(getModel().getRobotToFiducialTransform());
getModel().addRegistrationListener(new IRegistrationListenerNR() {
public void onFiducialToGlobalUpdate(AbstractKinematicsNR source, TransformNR registration) {
}
public void onBaseToFiducialUpdate(AbstractKinematicsNR source, TransformNR registration) {
getRobReg().setTransform(registration);
}
});
JPanel poses = new JPanel(new MigLayout());
JPanel registration = new JPanel(new MigLayout());
registration.add(new JLabel("Robot Registration"), "wrap");
registration.add(getRas(), "wrap");
registration.add(getRobReg(), "wrap");
poses.add(registration);
poses.add(new PosePanelNR(getModel(), true, true, "Current Actual Pose"));
poses.add(new PosePanelNR(getModel(), false, true, "Current Target Pose"));
setPanel = new PosePanelNR(getModel(), false, false, "New Target Pose");
poses.add(setPanel, "wrap");
JPanel buttons = new JPanel(new MigLayout());
buttons.add(estop);
buttons.add(getHomeAll());
JPanel standard = new JPanel(new MigLayout());
standard.add(poses, "wrap");
standard.add(buttons, "wrap");
standard.add(links, "wrap");
add(extra, "wrap");
add(standard, "wrap");
}
Aggregations