Startup
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//package com.stormbots;
|
||||
/**
|
||||
* Small, easy to use PID implementation with advanced controller capability.<br>
|
||||
* Minimal usage:<br>
|
||||
@@ -8,7 +9,7 @@
|
||||
*
|
||||
* @see http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-direction/improving-the-beginners-pid-introduction
|
||||
*/
|
||||
public class PID{
|
||||
public class MiniPID{
|
||||
//**********************************
|
||||
// Class private variables
|
||||
//**********************************
|
||||
@@ -50,7 +51,7 @@ public class PID{
|
||||
* @param i Integral gain. Becomes large if setpoint cannot reach target quickly.
|
||||
* @param d Derivative gain. Responds quickly to large changes in error. Small values prevents P and I terms from causing overshoot.
|
||||
*/
|
||||
public PID(double p, double i, double d){
|
||||
public MiniPID(double p, double i, double d){
|
||||
P=p; I=i; D=d;
|
||||
checkSigns();
|
||||
}
|
||||
@@ -63,7 +64,7 @@ public class PID{
|
||||
* @param d Derivative gain. Responds quickly to large changes in error. Small values prevents P and I terms from causing overshoot.
|
||||
* @param f Feed-forward gain. Open loop "best guess" for the output should be. Only useful if setpoint represents a rate.
|
||||
*/
|
||||
public PID(double p, double i, double d, double f){
|
||||
public MiniPID(double p, double i, double d, double f){
|
||||
P=p; I=i; D=d; F=f;
|
||||
checkSigns();
|
||||
}
|
||||
@@ -1053,6 +1053,21 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReticleActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="buttonScale">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="getIcon("Scale")" type="code"/>
|
||||
</Property>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value=" "/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Show Colormap Scale"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonScaleActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JToggleButton" name="buttonTitle">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
|
||||
@@ -523,6 +523,7 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
});
|
||||
renderer.getPopupMenu().setVisible(false);
|
||||
buttonScale.setSelected(renderer.getShowColormapScale());
|
||||
clearMarker();
|
||||
|
||||
showFit = buttonFit.isSelected();
|
||||
@@ -1000,7 +1001,12 @@ public class ScreenPanel3 extends Panel {
|
||||
imageBuffer.add(currentFrame);
|
||||
if (imageBuffer.size() > imageBufferLenght) {
|
||||
imageBuffer.remove(0);
|
||||
setBufferFull(true);
|
||||
} else {
|
||||
setBufferFull(false);
|
||||
}
|
||||
} else {
|
||||
setBufferFull(true);
|
||||
}
|
||||
//Update data
|
||||
if (!renderer.isPaused()) {
|
||||
@@ -1108,16 +1114,24 @@ public class ScreenPanel3 extends Panel {
|
||||
|
||||
@Override
|
||||
public void onImage(Object o, BufferedImage bi, Data data) {
|
||||
if (continuous) {
|
||||
buffer.add(data);
|
||||
if (buffer.size() >= numImages) {
|
||||
for (Data d : buffer) {
|
||||
process(d);
|
||||
try{
|
||||
if (continuous) {
|
||||
buffer.add(data);
|
||||
if (buffer.size() >= numImages) {
|
||||
for (Data d : buffer) {
|
||||
process(d);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buffer.add(null); //Just to count
|
||||
process(data);
|
||||
}
|
||||
} else {
|
||||
buffer.add(null); //Just to count
|
||||
process(data);
|
||||
} catch (Exception ex){
|
||||
buffer.clear();
|
||||
integration = null;
|
||||
ImageIntegrator.this.pushData(null);
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
if (buffer.size() >= numImages) {
|
||||
if (continuous) {
|
||||
@@ -1148,6 +1162,17 @@ public class ScreenPanel3 extends Panel {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
boolean bufferFull = true;
|
||||
|
||||
void setBufferFull(boolean value){
|
||||
if (value != bufferFull){
|
||||
SwingUtilities.invokeLater(()->{
|
||||
buttonPause.setBackground(value ? buttonSave.getBackground() : buttonSave.getBackground().brighter());
|
||||
});
|
||||
bufferFull = value;
|
||||
}
|
||||
}
|
||||
|
||||
volatile Dimension imageSize;
|
||||
|
||||
@@ -1163,6 +1188,7 @@ public class ScreenPanel3 extends Panel {
|
||||
renderer.refresh();
|
||||
}
|
||||
|
||||
|
||||
void checkMarker(Point p) throws IOException {
|
||||
if (camera != null) {
|
||||
if (buttonMarker.isSelected()) {
|
||||
@@ -1477,7 +1503,7 @@ public class ScreenPanel3 extends Panel {
|
||||
updateColormap();
|
||||
updateButtons();
|
||||
checkHistogram.setSelected((histogramDialog != null) && (histogramDialog.isShowing()));
|
||||
|
||||
buttonScale.setSelected(renderer.getShowColormapScale());
|
||||
try{
|
||||
Frame frame = getCurrentFrame();
|
||||
if (frame!=lastFrame){
|
||||
@@ -2652,6 +2678,7 @@ public class ScreenPanel3 extends Panel {
|
||||
buttonProfile = new javax.swing.JToggleButton();
|
||||
buttonFit = new javax.swing.JToggleButton();
|
||||
buttonReticle = new javax.swing.JToggleButton();
|
||||
buttonScale = new javax.swing.JToggleButton();
|
||||
buttonTitle = new javax.swing.JToggleButton();
|
||||
pauseSelection = new ch.psi.pshell.swing.ValueSelection();
|
||||
panelCameraSelection = new javax.swing.JPanel();
|
||||
@@ -3335,6 +3362,19 @@ public class ScreenPanel3 extends Panel {
|
||||
});
|
||||
toolBar.add(buttonReticle);
|
||||
|
||||
buttonScale.setIcon(getIcon("Scale"));
|
||||
buttonScale.setSelected(true);
|
||||
buttonScale.setText(" ");
|
||||
buttonScale.setToolTipText("Show Colormap Scale");
|
||||
buttonScale.setFocusable(false);
|
||||
buttonScale.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
buttonScale.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonScaleActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
toolBar.add(buttonScale);
|
||||
|
||||
buttonTitle.setIcon(getIcon("Title"));
|
||||
buttonTitle.setSelected(true);
|
||||
buttonTitle.setText(" ");
|
||||
@@ -3963,6 +4003,14 @@ public class ScreenPanel3 extends Panel {
|
||||
}
|
||||
}//GEN-LAST:event_buttonTitleActionPerformed
|
||||
|
||||
private void buttonScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScaleActionPerformed
|
||||
try {
|
||||
renderer.setShowColormapScale(buttonScale.isSelected());
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonScaleActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btFixColormapRange;
|
||||
private javax.swing.JRadioButton buttonAutomatic;
|
||||
@@ -3980,6 +4028,7 @@ public class ScreenPanel3 extends Panel {
|
||||
private javax.swing.JToggleButton buttonProfile;
|
||||
private javax.swing.JToggleButton buttonReticle;
|
||||
private javax.swing.JToggleButton buttonSave;
|
||||
private javax.swing.JToggleButton buttonScale;
|
||||
private javax.swing.JRadioButton buttonServer;
|
||||
private javax.swing.JToggleButton buttonSidePanel;
|
||||
private javax.swing.JButton buttonStreamData;
|
||||
|
||||
4067
plugins/ScreenPanel3New.java
Normal file
4067
plugins/ScreenPanel3New.java
Normal file
File diff suppressed because it is too large
Load Diff
1164
plugins/ScreenPanel3OLD.form
Normal file
1164
plugins/ScreenPanel3OLD.form
Normal file
File diff suppressed because it is too large
Load Diff
3934
plugins/ScreenPanel3OLD.java
Normal file
3934
plugins/ScreenPanel3OLD.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -109,7 +109,7 @@
|
||||
<Component class="javax.swing.JSpinner" name="spinnerSteps">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="0" maximum="100" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
<SpinnerModel initial="10" maximum="100" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TestScan extends Panel {
|
||||
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel3.setText("Steps:");
|
||||
|
||||
spinnerSteps.setModel(new javax.swing.SpinnerNumberModel(0, 0, 100, 1));
|
||||
spinnerSteps.setModel(new javax.swing.SpinnerNumberModel(10, 0, 100, 1));
|
||||
|
||||
buttonStart.setText("Start");
|
||||
buttonStart.addActionListener(new java.awt.event.ActionListener() {
|
||||
@@ -149,9 +149,14 @@ public class TestScan extends Panel {
|
||||
pars.add(spinnerStart.getValue());
|
||||
pars.add(spinnerEnd.getValue());
|
||||
pars.add(spinnerSteps.getValue());
|
||||
runAsync("TestScan", pars);
|
||||
runAsync("test/TestScan", pars).handle((ret, ex)->{
|
||||
if (ex != null){
|
||||
showException((Exception)ex);
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(TestScan.class.getName()).log(Level.SEVERE, null, ex);
|
||||
showException((Exception)ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonStartActionPerformed
|
||||
|
||||
|
||||
28
plugins/a.form
Normal file
28
plugins/a.form
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="449" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="137" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Form>
|
||||
52
plugins/a.java
Normal file
52
plugins/a.java
Normal file
@@ -0,0 +1,52 @@
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class a extends Panel {
|
||||
|
||||
public a() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
//Overridable callbacks
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecutedFile(String fileName, Object result) {
|
||||
}
|
||||
|
||||
|
||||
//Callback to perform update - in event thread
|
||||
@Override
|
||||
protected void doUpdate() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 449, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 137, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
Reference in New Issue
Block a user