Added about-page and added long-click for changing into space-mode. Pretty much done now.
This commit is contained in:
@@ -23,6 +23,10 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name="org.hitlabnz.sensor_fusion_demo.AboutActivity"
|
||||||
|
android:label="@string/title_activity_about" >
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
57
assets/about/de/index.html
Normal file
57
assets/about/de/index.html
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<html>
|
||||||
|
<body link="#ff8800" vlink="#ff8800" alink="#ff8800">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Diese App wurde von <a href="http://my-it.at">Alexander Pacha</a> am <a
|
||||||
|
href="http://www.hitlabnz.org">Human Interface Technology
|
||||||
|
Laboratory New Zealand</a> entwickelt und demonstriert die
|
||||||
|
Leistungsf<73>higkeit von verschiedenen Sensoren und Sensorfusionen.
|
||||||
|
Messungen von dem Gyroskop, Akzelerometer und Kompass werden in
|
||||||
|
verschiedenen Weisen kombiniert und das Ergebnis wird als W<>rfel
|
||||||
|
visualisiert, der durch rotieren des Ger<65>tes gedreht werden kann.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Die gro<72>e Neuheit in dieser Applikation ist die Fusion von zwei
|
||||||
|
virtuellen Sensoren: <b>Improved Orientation Sensor 1</b> und <b>Improved
|
||||||
|
Orientation Sensor 2</b> nutzt den Android Rotation Vector mit dem
|
||||||
|
kalibrierten Gyroskopsensor mit einer nie zuvor dagewesenen Pr<50>zision
|
||||||
|
und Reaktionsf<73>higkeit.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Neben diesen beiden Sensorfusionen gibt es noch weitere Sensoren
|
||||||
|
zum Vergleich:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Improved Orientation Sensor 1 (Sensorfusion des Android
|
||||||
|
Rotation Vector und des kalibrierten Gyroskops - weniger stabil,
|
||||||
|
daf<61>r genauer)</li>
|
||||||
|
<li>Improved Orientation Sensor 2 (Sensorfusion des Android
|
||||||
|
Rotation Vector und des kalibrierten Gyroskops - stabiler, daf<61>r
|
||||||
|
ungenauer)</li>
|
||||||
|
<li>Android Rotation Vector (Kalmanfilterfusion von Akzelerometer
|
||||||
|
+ Gyroskop + Kompass) - die bisher beste verf<72>gbare Fusion!</li>
|
||||||
|
<li>Kalibriertes Gyroskop (Weiteres Ergebnis der
|
||||||
|
Kalmanfilterfusion von Akzelerometer + Gyroskop + Kompass). Liefert
|
||||||
|
nur relative Rotation, kann daher von den anderen Sensoren abweichen.</li>
|
||||||
|
<li>Gravitation + Kompass</li>
|
||||||
|
<li>Akzelerometer + Kompass</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Die Anwendung wurde entwickelt um die im Rahmer der <a
|
||||||
|
href="http://my-it.at/index.php/publikationen">Masterarbeit</a> "Sensor
|
||||||
|
fusion for robust outdoor Augmented Reality tracking on mobile devices"
|
||||||
|
<a href="http://my-it.at/media/MasterThesis-Pacha.pdf">(download)</a>
|
||||||
|
entwickelte Sensorfusion zu demonstrieren. Die App wurde am <a
|
||||||
|
href="http://www.hitlabnz.org">Human Interface Technology
|
||||||
|
Laboratory New Zealand</a> entwickelt.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Lange auf den W<>rfel gedr<64>ckt halten, um kurzfristig in den Raummodus zu wechseln.</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Der Quellcode ist <20>ffentlich verf<72>gbar auf <a
|
||||||
|
href="https://bitbucket.org/apacha/sensor-fusion-demo/">Bitbucket</a>
|
||||||
|
unter der MIT Lizenz.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
52
assets/about/en/index.html
Normal file
52
assets/about/en/index.html
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<html>
|
||||||
|
<body link="#ff8800" vlink="#ff8800" alink="#ff8800">
|
||||||
|
|
||||||
|
<p>This application was developed by <a href="http://my-it.at">Alexander Pacha</a> at the <a href="http://www.hitlabnz.org">Human Interface
|
||||||
|
Technology Laboratory New Zealand</a> to demonstrate the
|
||||||
|
capabilities of various sensors and sensor fusion approaches. Data
|
||||||
|
from the Gyroscope, Accelerometer and compass are combined in
|
||||||
|
different ways and the result is shown as a cube that can be rotated
|
||||||
|
by rotating the device.</p>
|
||||||
|
<p>
|
||||||
|
The major novelty in this application is the fusion of virtual
|
||||||
|
sensors: <b>Improved Orientation Sensor 1</b> and <b>Improved
|
||||||
|
Orientation Sensor 2</b> fuse the Android Rotation Vector with the
|
||||||
|
virtual Gyroscope sensor to achieve a pose estimation with a
|
||||||
|
previously unknown stability and precision.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Apart from these two sensors, the following sensors are
|
||||||
|
available for comparison:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Improved Orientation Sensor 1 (Sensor fusion of Android
|
||||||
|
Rotation Vector and Calibrated Gyroscope - less stable but more
|
||||||
|
accurate)</li>
|
||||||
|
<li>Improved Orientation Sensor 2 (Sensor fusion of Android
|
||||||
|
Rotation Vector and Calibrated Gyroscope - more stable but less
|
||||||
|
accurate)</li>
|
||||||
|
<li>Android Rotation Vector (Kalman filter fusion of
|
||||||
|
Accelerometer + Gyroscope + Compass)</li>
|
||||||
|
<li>Calibrated Gyroscope (Separate result of Kalman filter fusion
|
||||||
|
of Accelerometer + Gyroscope + Compass)</li>
|
||||||
|
<li>Gravity + Compass</li>
|
||||||
|
<li>Accelerometer + Compass</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This application was developed for demonstrating the sensor fusion
|
||||||
|
approach developed for my <a
|
||||||
|
href="http://my-it.at/index.php/publikationen">Master thesis</a> "Sensor fusion for robust outdoor Augmented Reality tracking on mobile
|
||||||
|
devices"
|
||||||
|
<a href="http://my-it.at/media/MasterThesis-Pacha.pdf">(download)</a> at the <a href="http://www.hitlabnz.org">Human Interface
|
||||||
|
Technology Laboratory New Zealand</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Long-click on a cube to temporarily change into the space-mode for this fusion.</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The source-code is publicly available at <a
|
||||||
|
href="https://bitbucket.org/apacha/sensor-fusion-demo/">Bitbucket</a>
|
||||||
|
and licensed under the MIT license.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
14
res/layout/activity_about.xml
Normal file
14
res/layout/activity_about.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".AboutActivity" >
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/webViewAbout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentTop="true" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
16
res/values-de/strings.xml
Normal file
16
res/values-de/strings.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<string name="app_name">Sensorfusions Demo</string>
|
||||||
|
<string name="action_about">Über</string>
|
||||||
|
<string name="title_main_activity">Sensorfusions Demo</string>
|
||||||
|
<string name="title_section1">Improved Orientation Sensor 1</string>
|
||||||
|
<string name="title_section2">Improved Orientation Sensor 2</string>
|
||||||
|
<string name="title_section3">Android Rotation Vector</string>
|
||||||
|
<string name="title_section4">Kalibriertes Gyroskop</string>
|
||||||
|
<string name="title_section5">Gravitation und Kompass</string>
|
||||||
|
<string name="title_section6">Akzelerometer und Kompass</string>
|
||||||
|
<string name="title_activity_sensor_selection">Sensorfusions Demo</string>
|
||||||
|
<string name="title_activity_about">Über</string>
|
||||||
|
|
||||||
|
</resources>
|
||||||
@@ -11,5 +11,6 @@
|
|||||||
<string name="title_section5">Gravity and Compass</string>
|
<string name="title_section5">Gravity and Compass</string>
|
||||||
<string name="title_section6">Accelerometer and Compass</string>
|
<string name="title_section6">Accelerometer and Compass</string>
|
||||||
<string name="title_activity_sensor_selection">Sensor fusion demo</string>
|
<string name="title_activity_sensor_selection">Sensor fusion demo</string>
|
||||||
|
<string name="title_activity_about">About</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
43
src/org/hitlabnz/sensor_fusion_demo/AboutActivity.java
Normal file
43
src/org/hitlabnz/sensor_fusion_demo/AboutActivity.java
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package org.hitlabnz.sensor_fusion_demo;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity, that displays a single WebView with the text shown under the section About in the settings
|
||||||
|
*
|
||||||
|
* @author Alexander Pacha
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AboutActivity extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_about);
|
||||||
|
|
||||||
|
// Get the locale substring to access the localised assets
|
||||||
|
String localPrefix = Locale.getDefault().getLanguage().substring(0, 2).toLowerCase(Locale.US);
|
||||||
|
|
||||||
|
// Load the website as the only action for this activity
|
||||||
|
WebView webView = (WebView) findViewById(R.id.webViewAbout);
|
||||||
|
webView.loadUrl("file:///android_asset/about/" + localPrefix + "/index.html");
|
||||||
|
|
||||||
|
// Enable the logo in the top left corner to bring the user back to another activity.
|
||||||
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,18 +56,49 @@ public class CubeRenderer implements GLSurfaceView.Renderer {
|
|||||||
// set-up modelview matrix
|
// set-up modelview matrix
|
||||||
gl.glMatrixMode(GL10.GL_MODELVIEW);
|
gl.glMatrixMode(GL10.GL_MODELVIEW);
|
||||||
gl.glLoadIdentity();
|
gl.glLoadIdentity();
|
||||||
gl.glTranslatef(0, 0, -3.0f);
|
|
||||||
|
|
||||||
if (orientationProvider != null) {
|
if (showCubeInsideOut) {
|
||||||
// All Orientation providers deliver Quaternion as well as rotation matrix.
|
float dist = 3;
|
||||||
// Use your favourite representation:
|
gl.glTranslatef(0, 0, -dist);
|
||||||
|
|
||||||
// Get the rotation from the current orientationProvider as rotation matrix
|
if (orientationProvider != null) {
|
||||||
//gl.glMultMatrixf(orientationProvider.getRotationMatrix().getMatrix(), 0);
|
// All Orientation providers deliver Quaternion as well as rotation matrix.
|
||||||
|
// Use your favourite representation:
|
||||||
|
|
||||||
// Get the rotation from the current orientationProvider as quaternion
|
// Get the rotation from the current orientationProvider as rotation matrix
|
||||||
Quaternion q = orientationProvider.getQuaternion();
|
//gl.glMultMatrixf(orientationProvider.getRotationMatrix().getMatrix(), 0);
|
||||||
gl.glRotatef((float) (2.0f * Math.acos(q.getW()) * 180.0f / Math.PI), q.getX(), q.getY(), q.getZ());
|
|
||||||
|
// Get the rotation from the current orientationProvider as quaternion
|
||||||
|
Quaternion q = orientationProvider.getQuaternion();
|
||||||
|
gl.glRotatef((float) (2.0f * Math.acos(q.getW()) * 180.0f / Math.PI), q.getX(), q.getY(), q.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw our object
|
||||||
|
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
|
||||||
|
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
|
||||||
|
|
||||||
|
mCube.draw(gl);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (orientationProvider != null) {
|
||||||
|
// All Orientation providers deliver Quaternion as well as rotation matrix.
|
||||||
|
// Use your favourite representation:
|
||||||
|
|
||||||
|
// Get the rotation from the current orientationProvider as rotation matrix
|
||||||
|
//gl.glMultMatrixf(orientationProvider.getRotationMatrix().getMatrix(), 0);
|
||||||
|
|
||||||
|
// Get the rotation from the current orientationProvider as quaternion
|
||||||
|
Quaternion q = orientationProvider.getQuaternion();
|
||||||
|
gl.glRotatef((float) (2.0f * Math.acos(q.getW()) * 180.0f / Math.PI), q.getX(), q.getY(), q.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
float dist = 3;
|
||||||
|
drawTranslatedCube(gl, 0, 0, -dist);
|
||||||
|
drawTranslatedCube(gl, 0, 0, dist);
|
||||||
|
drawTranslatedCube(gl, 0, -dist, 0);
|
||||||
|
drawTranslatedCube(gl, 0, dist, 0);
|
||||||
|
drawTranslatedCube(gl, -dist, 0, 0);
|
||||||
|
drawTranslatedCube(gl, dist, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw our object
|
// draw our object
|
||||||
@@ -77,6 +108,26 @@ public class CubeRenderer implements GLSurfaceView.Renderer {
|
|||||||
mCube.draw(gl);
|
mCube.draw(gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a translated cube
|
||||||
|
*
|
||||||
|
* @param gl the surface
|
||||||
|
* @param translateX x-translation
|
||||||
|
* @param translateY y-translation
|
||||||
|
* @param translateZ z-translation
|
||||||
|
*/
|
||||||
|
private void drawTranslatedCube(GL10 gl, float translateX, float translateY, float translateZ) {
|
||||||
|
gl.glPushMatrix();
|
||||||
|
gl.glTranslatef(translateX, translateY, translateZ);
|
||||||
|
|
||||||
|
// draw our object
|
||||||
|
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
|
||||||
|
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
|
||||||
|
|
||||||
|
mCube.draw(gl);
|
||||||
|
gl.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update view-port with the new surface
|
* Update view-port with the new surface
|
||||||
*
|
*
|
||||||
@@ -101,4 +152,16 @@ public class CubeRenderer implements GLSurfaceView.Renderer {
|
|||||||
// clear screen in black
|
// clear screen in black
|
||||||
gl.glClearColor(0, 0, 0, 1);
|
gl.glClearColor(0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag indicating whether you want to view inside out, or outside in
|
||||||
|
*/
|
||||||
|
private boolean showCubeInsideOut = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles whether the cube will be shown inside-out or outside in.
|
||||||
|
*/
|
||||||
|
public void toggleShowCubeInsideOut() {
|
||||||
|
this.showCubeInsideOut = !showCubeInsideOut;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.hitlabnz.sensor_fusion_demo.orientationProvider.ImprovedOrientationSe
|
|||||||
import org.hitlabnz.sensor_fusion_demo.orientationProvider.OrientationProvider;
|
import org.hitlabnz.sensor_fusion_demo.orientationProvider.OrientationProvider;
|
||||||
import org.hitlabnz.sensor_fusion_demo.orientationProvider.RotationVectorProvider;
|
import org.hitlabnz.sensor_fusion_demo.orientationProvider.RotationVectorProvider;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import android.opengl.GLSurfaceView;
|
import android.opengl.GLSurfaceView;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -20,7 +21,9 @@ import android.support.v4.app.FragmentPagerAdapter;
|
|||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.OnLongClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,6 +70,18 @@ public class SensorSelectionActivity extends FragmentActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle item selection
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.action_about:
|
||||||
|
Intent intent = new Intent(this, AboutActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
||||||
* one of the sections/tabs/pages.
|
* one of the sections/tabs/pages.
|
||||||
@@ -200,6 +215,15 @@ public class SensorSelectionActivity extends FragmentActivity {
|
|||||||
mGLSurfaceView = new GLSurfaceView(getActivity());
|
mGLSurfaceView = new GLSurfaceView(getActivity());
|
||||||
mGLSurfaceView.setRenderer(mRenderer);
|
mGLSurfaceView.setRenderer(mRenderer);
|
||||||
|
|
||||||
|
mGLSurfaceView.setOnLongClickListener(new OnLongClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
mRenderer.toggleShowCubeInsideOut();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return mGLSurfaceView;
|
return mGLSurfaceView;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user