Skip to content

Commit

Permalink
DavisConfig: Added dual view of user-friendly and bias currents. Clea…
Browse files Browse the repository at this point in the history
…ned up layout

Info/EventRateEstimator: can pause rate updates after bias change
DvsTweaks: Improved bandwidth control to only PRSF bias changing
DavisTextInputReader: multiple improvements for Ziwei rotating dot
  • Loading branch information
Tobi Delbruck authored and Tobi Delbruck committed Dec 19, 2023
1 parent 41b78e2 commit 6e758ba
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 348 deletions.
2 changes: 1 addition & 1 deletion src/ch/unizh/ini/jaer/chip/retina/DVS128.java
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ public void setBandwidthTweak(float val) {
}
bandwidth = val;
final float MAX = 300;
// pr.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
pr.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
sf.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
getSupport().firePropertyChange(DVSTweaks.BANDWIDTH, old, val);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {

public void setBandwidthTweak(float val) {
final float MAX = 300;
// pr.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
pr.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
sf.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
}

Expand Down
6 changes: 0 additions & 6 deletions src/ch/unizh/ini/jaer/chip/retina/DVSTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ public interface DVSTweaks {

/**
* Tweaks front end bandwidth, larger is higher bandwidth.
*
* Adjust the source follower bandwidth by changing PRSf bias current.
*
* <p> For minimum shot noise under low illumination, the photoreceptor bias should be large and
* the bandwidth should be limited by the source follower buffer.
* See <a href="https://arxiv.org/abs/2304.04019">Optimal biasing and physical limits of DVS event noise</a>.
*
* @param val -1 to 1 range
*/
Expand Down
80 changes: 22 additions & 58 deletions src/eu/seebetter/ini/chips/davis/DavisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import eu.seebetter.ini.chips.davis.imu.ImuAccelScale;
import eu.seebetter.ini.chips.davis.imu.ImuControl;
import eu.seebetter.ini.chips.davis.imu.ImuControlPanel;
import javax.swing.UIManager;
import net.sf.jaer.biasgen.AddressedIPotArray;
import net.sf.jaer.biasgen.Biasgen;
import net.sf.jaer.biasgen.BiasgenHardwareInterface;
Expand Down Expand Up @@ -84,9 +83,7 @@ public class DavisConfig extends Biasgen implements DavisDisplayConfigInterface,
// subclasses for controlling aspects of camera
protected DavisConfig.VideoControl videoControl;
protected ImuControl imuControlGUI;
EngineeringFormat eng = new EngineeringFormat();

private boolean dualUserFriendlyAndBiasCurrentsViewEnabled = false;
EngineeringFormat eng=new EngineeringFormat();

public DavisConfig(final Chip chip) {
super(chip);
Expand Down Expand Up @@ -408,10 +405,9 @@ public String processRemoteControlCommand(final RemoteControlCommand command, fi
}

private ParameterControlPanel videoParameterControlPanel;
private JPanel userFriendlyControls, combinedBiasShiftedSourcePanel;
private JPanel userFriendlyControls;
private JPanel configPanel;
private JTabbedPane configTabbedPane;
private JPanel dualViewPanel;

// threshold for triggering a new frame snapshot automatically
private int autoShotThreshold;
Expand All @@ -436,82 +432,57 @@ public JPanel buildControlPanel() {
configPanel = new JPanel();
configPanel.setLayout(new BorderLayout());

makeConfigTabbedPane();

// only select panel after all added
configPanel.add(configTabbedPane, BorderLayout.CENTER);

setBatchEditOccurring(false);
return configPanel;
}

/**
* Sets dual view of user friendly and bias currents
*/
void setDualView(boolean selected) {
if (selected) {
makeDualViewPanel();
configPanel.removeAll();
configPanel.add(dualViewPanel, BorderLayout.CENTER);
} else {
makeConfigTabbedPane();
configPanel.removeAll();
configPanel.add(configTabbedPane, BorderLayout.CENTER);
}
configPanel.validate();
}

private void makeDualViewPanel() {
dualViewPanel = new JPanel();
dualViewPanel.setLayout(new BorderLayout());
dualViewPanel.add(userFriendlyControls, BorderLayout.WEST); // removes it from configTabbedPane
dualViewPanel.add(combinedBiasShiftedSourcePanel, BorderLayout.EAST); // removes it from configTabbedPane
}

private void makeConfigTabbedPane() {
configTabbedPane = new JTabbedPane();
userFriendlyControls = new DavisUserControlPanel(getChip());
configTabbedPane.addTab("<html><strong><font color=\"red\">User-Friendly Controls", userFriendlyControls);

// biasgen
combinedBiasShiftedSourcePanel = new JPanel();
final JPanel combinedBiasShiftedSourcePanel = new JPanel();
combinedBiasShiftedSourcePanel
.add(new JLabel("<html>Low-level control of on-chip bias currents and voltages. <p>These are only for experts!"));
combinedBiasShiftedSourcePanel.setLayout(new BoxLayout(combinedBiasShiftedSourcePanel, BoxLayout.Y_AXIS));
combinedBiasShiftedSourcePanel.add(super.buildControlPanel());
combinedBiasShiftedSourcePanel.add(new ShiftedSourceControlsCF(ssp));
combinedBiasShiftedSourcePanel.add(new ShiftedSourceControlsCF(ssn));
configTabbedPane.addTab("Bias Current Config", combinedBiasShiftedSourcePanel);

// Multiplexer
final JPanel muxPanel = new JPanel();
muxPanel.setLayout(new BoxLayout(muxPanel, BoxLayout.Y_AXIS));
configTabbedPane.addTab("Multiplexer Config", muxPanel);
SPIConfigValue.addGUIControls(muxPanel, muxControl);

// DVS
final JPanel dvsPanel = new JPanel();
dvsPanel.setLayout(new BoxLayout(dvsPanel, BoxLayout.Y_AXIS));
configTabbedPane.addTab("DVS Config", dvsPanel);
SPIConfigValue.addGUIControls(dvsPanel, dvsControl);

// APS
final JPanel apsPanel = new JPanel();
apsPanel.setLayout(new BoxLayout(apsPanel, BoxLayout.Y_AXIS));
configTabbedPane.addTab("APS Config", apsPanel);
SPIConfigValue.addGUIControls(apsPanel, apsControl);

// IMU
final JPanel imuControlPanel = new JPanel();
imuControlPanel.add(new JLabel("<html>Low-level control of integrated inertial measurement unit."));
imuControlPanel.setLayout(new BoxLayout(imuControlPanel, BoxLayout.Y_AXIS));
imuControlPanel.add(new ImuControlPanel(this));
configTabbedPane.addTab("IMU Config", imuControlPanel);

// External Input
final JPanel extPanel = new JPanel();
extPanel.setLayout(new BoxLayout(extPanel, BoxLayout.Y_AXIS));
configTabbedPane.addTab("External Input Config", extPanel);
SPIConfigValue.addGUIControls(extPanel, extInControl);

// Chip config
final JPanel chipPanel = new JPanel();
chipPanel.setLayout(new BoxLayout(chipPanel, BoxLayout.Y_AXIS));
configTabbedPane.addTab("Chip Config", chipPanel);
SPIConfigValue.addGUIControls(chipPanel, chipControl);

// Autoexposure
if (getChip() instanceof DavisBaseCamera) {
final JPanel autoExposurePanel = new JPanel();
Expand All @@ -521,29 +492,37 @@ private void makeConfigTabbedPane() {
autoExposurePanel.add(new ParameterControlPanel(((DavisBaseCamera) getChip()).getAutoExposureController()));
configTabbedPane.addTab("APS Autoexposure Control", autoExposurePanel);
}

// Video Control
final JPanel videoControlPanel = new JPanel();
videoControlPanel.add(new JLabel("<html>Controls display of APS video frame data"));
videoControlPanel.setLayout(new BoxLayout(videoControlPanel, BoxLayout.Y_AXIS));
videoParameterControlPanel = new ParameterControlPanel(getVideoControl());
videoControlPanel.add(videoParameterControlPanel);
configTabbedPane.addTab("Video Control", videoControlPanel);

getVideoControl().addObserver(videoParameterControlPanel);
getVideoControl().getContrastContoller().addObserver(videoParameterControlPanel);

// make special dual view panel for seeing effect of userFriendlyControls on bias currents
// only select panel after all added
configPanel.add(configTabbedPane, BorderLayout.CENTER);

try {
configTabbedPane.setSelectedIndex(getChip().getPrefs().getInt("DavisBaseCamera.bgTabbedPaneSelectedIndex", 0));
} catch (final IndexOutOfBoundsException e) {
configTabbedPane.setSelectedIndex(0);
}

// add listener to store last selected tab
configTabbedPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent evt) {
tabbedPaneMouseClicked(evt);
}
});

setBatchEditOccurring(false);
return configPanel;
}

@Override
Expand Down Expand Up @@ -674,7 +653,7 @@ public void setBandwidthTweak(float val) {
// log.info("tweak bandwidth by " + val);
bandwidth = val;
final float MAX = 30;
// pr.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
pr.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
sf.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MAX));
getChip().getSupport().firePropertyChange(DVSTweaks.BANDWIDTH, old, val);
}
Expand Down Expand Up @@ -978,7 +957,7 @@ public float getPhotoreceptorSourceFollowerBandwidthHz() {
// computed based on Davis240/346 C1=132fF and estimated SF bias current
float iSf = sf.getCurrent(), iPr = pr.getCurrent();
if (iSf > iPr * .5) {
log.info(String.format("Source follower bias current (%sA) is larger than half of Photoreceptor bias current (%sA); cannot estimate cutoff frequency from SF current alone", eng.format(iSf), eng.format(iPr)));
log.info(String.format("Source follower bias current (%sA) is larger than half of Photoreceptor bias current (%sA); cannot estimate cutoff frequency from SF current alone",eng.format(iSf),eng.format(iPr)));
return Float.NaN;
}
// TODO note from IMU we have temperature, could account for it in thermal voltage
Expand Down Expand Up @@ -1312,19 +1291,4 @@ public static SPIConfigValue getConfigValueByName(final List<SPIConfigValue> con

return null;
}

/**
* @return the dualUserFriendlyAndBiasCurrentsViewEnabled
*/
public boolean isDualUserFriendlyAndBiasCurrentsViewEnabled() {
return dualUserFriendlyAndBiasCurrentsViewEnabled;
}

/**
* @param dualUserFriendlyAndBiasCurrentsViewEnabled the
* dualUserFriendlyAndBiasCurrentsViewEnabled to set
*/
public void setDualUserFriendlyAndBiasCurrentsViewEnabled(boolean dualUserFriendlyAndBiasCurrentsViewEnabled) {
this.dualUserFriendlyAndBiasCurrentsViewEnabled = dualUserFriendlyAndBiasCurrentsViewEnabled;
}
}
Loading

0 comments on commit 6e758ba

Please sign in to comment.