Skip to content

Commit

Permalink
Merge pull request #66 from stmoon/noise-control
Browse files Browse the repository at this point in the history
sensor noise parameter control dialog
  • Loading branch information
bkueng authored Jan 11, 2018
2 parents 21a0ad7 + 9ba65af commit 0000858
Show file tree
Hide file tree
Showing 14 changed files with 389 additions and 19 deletions.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Requirements:
* Java 7 or newer (JDK, http://www.oracle.com/technetwork/java/javase/downloads/index.html)

* Java3D and JOGL/JOAL jars, including native libs for Linux (i586/64bit), Windows (i586/64bit) and Mac OS (universal) already included in this repository, no need to install it.

* libvecmath-java (for ubuntu)

Clone repository and initialize submodules:
Expand Down Expand Up @@ -65,6 +65,47 @@ On **Windows** use `;` instead of `:` in -cp:
java -cp lib/*;out/production/jmavsim.jar me.drton.jmavsim.Simulator
```

#### Key command ####

Views:
- F - First-person-view camera.
- S - Stationary ground camera.
- G - Gimbal camera.
- Z - Toggle auto-zoom for Stationary camera.
- +/- - Zoom in/out
- 0/ENTER - Reset zoom to default.

Actions:
- Q - Disable sim on MAV.
- I - Enable sim on MAV.
- H - Toggle HUD overlay.
- C - Clear all messages on HUD.
- R - Toggle data report sidebar.
- T - Toggle data report updates.
- D - Toggle sensor parameter control sidebar.
- F1 - Show this key commands reference.
- ESC - Exit jMAVSim.
- SPACE - Reset vehicle & view to start position.

Manipulate Vehicle:
- ARROW KEYS - Rotate around pitch/roll.
- END/PG-DN - Rotate CCW/CW around yaw.
- SHIFT + ARROWS - Move N/S/E/W.
- SHIFT + INS/DEL - Move Up/Down.
- NUMPAD 8/2/4/6 - Start/increase rotation rate around pitch/roll axis.
- NUMPAD 1/3 - Start/increase rotation rate around yaw axis.
- NUMPAD 5 - Stop all rotation.
- CTRL + NUMPAD 5 - Reset vehicle attitude, velocity, & accelleration.

Manipulate Environment:
- ALT +
- ARROW KEYS - Increase wind deviation in N/S/E/W direction.
- INS/DEL - Increase wind deviation in Up/Down direction.
- NUMPAD 8/2/4/6 - Increase wind speed in N/S/E/W direction.
- NUMPAD 7/1 - Increase wind speed in Up/Down direction.
- NUMPAD 5 - Stop all wind and deviations.

- CTRL+ Manipulate - Rotate/move/increase at a higher/faster rate.

### Troubleshooting ###

Expand Down
15 changes: 13 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@
<pathelement location="lib/annotations.jar"/>
</path>

<path id="javac2.class.path">
<pathelement location="lib/annotations.jar"/>
<pathelement location="lib/javac2.jar"/>
<pathelement location="lib/asm4-all.jar"/>
<pathelement location="lib/jdom.jar"/>
<pathelement location="lib/vecmath.jar"/>
</path>

<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.class.path"/>

<target name="compile" description="Compile java sources" depends="make_dirs">
<javac destdir="${classes.dir}" includeantruntime="false" debug="true">
<javac2 destdir="${classes.dir}" includeantruntime="false" debug="true">
<classpath refid="libsclasspath"/>
<src path="src"/>
<src path="jMAVlib/src"/>
</javac>
</javac2>
</target>

<target name="jmavsim" description="Link classes and JARs for jMAVSim" depends="compile">
Expand Down Expand Up @@ -55,6 +65,7 @@
<zipfileset dir="lib" includes="jogl-all.jar"/>
<zipfileset dir="lib" includes="jssc.jar"/>
<zipfileset dir="lib" includes="vecmath.jar"/>
<zipgroupfileset dir="lib" includes="forms_rt.jar"/>

<!-- OS-specific jars (can exclude any you don't need) -->

Expand Down
17 changes: 6 additions & 11 deletions jMAVSim.ipr
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
</artifact>
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="?*.properties" />
<entry name="?*.xml" />
Expand All @@ -35,19 +33,17 @@
<entry name="?*.tld" />
<entry name="?*.ftl" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
<component name="CopyrightManager" default="" />
<component name="DependencyValidationManager">
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</component>
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
<component name="EntryPointsManager">
<entry_points version="2.0" />
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
</profile>
<version value="1.0" />
</component>
<component name="Palette2">
<group name="Swing">
Expand Down Expand Up @@ -175,11 +171,10 @@
<module fileurl="file://$PROJECT_DIR$/jMAVSim.iml" filepath="$PROJECT_DIR$/jMAVSim.iml" />
</modules>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/jMAVlib" vcs="Git" />
</component>
Expand Down
Binary file added lib/asm4-all.jar
Binary file not shown.
Binary file added lib/forms_rt.jar
Binary file not shown.
Binary file added lib/javac2.jar
Binary file not shown.
Binary file added lib/jdom.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions src/me/drton/jmavsim/LogPlayerSensors.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,12 @@ public void setReset(boolean reset) {
this.reset = reset;
}

@Override
public void setParameter(String name, float value) {}

@Override
public float param(String name) {
return 0.0f;
}

}
113 changes: 113 additions & 0 deletions src/me/drton/jmavsim/SensorParamPanel.form
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="me.drton.jmavsim.SensorParamPanel">
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="261"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="eeb85" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Accel Noise StdDev"/>
</properties>
</component>
<component id="b28e0" class="javax.swing.JSpinner" binding="accelSpinner">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="d01db" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Gyro Noise StdDev"/>
</properties>
</component>
<component id="1d206" class="javax.swing.JSpinner" binding="gyroSpinner">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="db1b1" class="javax.swing.JLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Mag Noise StdDev"/>
</properties>
</component>
<component id="75b59" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Pressure Noise StdDev"/>
</properties>
</component>
<component id="a8c5e" class="javax.swing.JLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="GPS Noise StdDev"/>
</properties>
</component>
<component id="3daf3" class="javax.swing.JSpinner" binding="magSpinner">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="98010" class="javax.swing.JSpinner" binding="presSpinner">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="a4cd8" class="javax.swing.JSpinner" binding="gpsSpinner">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="3d1a1" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="--- VEHICLE ---"/>
</properties>
</component>
<component id="dec3b" class="javax.swing.JLabel">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="mass"/>
</properties>
</component>
<component id="ec391" class="javax.swing.JSpinner" binding="massSpinner">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="df8a0" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="--- SENSORS ---"/>
</properties>
</component>
</children>
</grid>
</form>
105 changes: 105 additions & 0 deletions src/me/drton/jmavsim/SensorParamPanel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package me.drton.jmavsim;

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
* @file SensorParamPanel.java
* Sensor Control Parameter Panel
*
* This panel is used for the sensor test and analysis
*
* @author SungTae Moon <[email protected]>
*/

public class SensorParamPanel extends JPanel {
private JSpinner accelSpinner;
private JSpinner gyroSpinner;
private JPanel mainPanel;
private JSpinner magSpinner;
private JSpinner presSpinner;
private JSpinner gpsSpinner;
private JSpinner massSpinner;

protected Sensors sensors = null;

public SensorParamPanel() {

this.add(mainPanel);

accelSpinner.setModel(new SpinnerNumberModel(0.0f, 0.0f, 1.0f, 0.01f));
gyroSpinner.setModel(new SpinnerNumberModel(0.0f, 0.0f, 1.0f, 0.01f));
gpsSpinner.setModel(new SpinnerNumberModel(0.0f, 0.0f, 100.0f, 1.0f));
magSpinner.setModel(new SpinnerNumberModel(0.0f, 0.0f, 1.0f, 0.001f));
presSpinner.setModel(new SpinnerNumberModel(0.0f, 0.0f, 1.0f, 0.01f));
massSpinner.setModel(new SpinnerNumberModel(0.0f, 0.0f, 5.0f, 0.1f));

accelSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
Double value = (Double)accelSpinner.getValue();
sensors.setParameter("noise_Acc", value.floatValue());
}
});

gyroSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
Double value = (Double)gyroSpinner.getValue();
sensors.setParameter("noise_Gyo", value.floatValue());
}
});

magSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
Double value = (Double)magSpinner.getValue();
sensors.setParameter("noise_Mag", value.floatValue());
}
});

presSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
Double value = (Double)presSpinner.getValue();
sensors.setParameter("noise_Prs", value.floatValue());
}
});

gpsSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
Double value = (Double)gpsSpinner.getValue();
sensors.setParameter("gpsNoiseStdDev", value.floatValue());
}
});

massSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
Double value = (Double)massSpinner.getValue();
sensors.setParameter("mass", value.floatValue());
}
});

}

public JPanel panel() {
return mainPanel;
}

public void setSensor(Sensors sensors) {
this.sensors = sensors;

// init value
accelSpinner.setValue(new Double(sensors.param("noise_Acc")));
gyroSpinner.setValue(new Double(sensors.param("noise_Gyo")));
magSpinner.setValue(new Double(sensors.param("noise_Mag")));
presSpinner.setValue(new Double(sensors.param("noise_Prs")));
gpsSpinner.setValue(new Double(sensors.param("gpsNoiseStdDev")));
massSpinner.setValue(new Double(sensors.param("mass")));

}

}
4 changes: 4 additions & 0 deletions src/me/drton/jmavsim/Sensors.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ public interface Sensors {

void update(long t);

void setParameter(String name, float value);

float param(String name);

}
Loading

0 comments on commit 0000858

Please sign in to comment.