Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • danc/MicroCART
  • snawerdt/MicroCART_17-18
  • bbartels/MicroCART_17-18
  • jonahu/MicroCART
4 results
Show changes
Showing
with 0 additions and 437 deletions
JSONCPP is required to build a VRPN server for the Vrpn Android widgets (see android_widgets directory).
If you've done a recursive clone, JSONCPP is in the submodules directory,
will be built automatically, and you can completely ignore the rest of this file.
Get the latest JSONCPP (r156 has been used successfully) from
http://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk/jsoncpp
You will also need Scons and Python
To build jsoncpp, see README.txt in the JSONCPP directory, but :
1/ Get scons-local (2.0.1 is OK) from http://www.scons.org/download.php
instead of the link in the README, then
extract scons-local into the jsoncpp directory as mentionned in the README
2/ To avoid LNK2005 errors when building VRPN, you will need to edit jsoncpp/Sconstruct
locate the section relative to your build environment, for instance :
elif platform == 'msvc90':
in this instruction block, replace the line :
env['CXXFLAGS']='xxxxxxx /MT'
by :
env['CXXFLAGS']='xxxxxxx /MD'
3/ To build with Visual Studio, run the Visual Studio command that configures environment variables
(on VS-2008-32, look for a file named vsvars32.bat), otherwise scons may not find the compiler
Then build, for instance with the command
c:\Python27\python.exe scons.py platform=msvc90
The values allowed for platform are
suncc vacpp mingw msvc6 msvc7 msvc71 msvc80 msvc90 linux-gcc
WARNING:
the JSONCPP build system builds a Release version. Using this release library with a
Debug VRPN server crashes.
To clean, use the command
c:\Python271\python.exe scons.py platform=msvc90 -c
Then, run CMAKE for VRPN, define VRPN_USE_JSONNET and JSONCPP_ROOT_DIR.
python_vrpn:
VRPN wrapped in Python using Swig. Works with Python 2.7.
python:
Hand-written Python classes that work with Python 2.7 and 3.2.
Compile the main library (ie.: root of VRPN) and the quat library. Then, go to the "python" folder. Before making the binary, you have to define the "PYTHON_VERSION" environment variable to the version of python you want to compile it for (ie.: "3.2", "2.7" ...). And you have to put the resulting vrpn.so shared library (found in $HW_OS/$PYTHON_VERSION) in the python module folder or in a path defined in the PYTHONPATH environment variable.
The "essai_*.py" are simple python files that show you how to use this module (the single difference is a call to python3.2 or python2.7 interpreter).
# - Print a developer warning, using author_warning if we have cmake 2.8
#
# warning_dev("your desired message")
#
# Original Author:
# 2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
function(warning_dev _yourmsg)
if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0")
# CMake version <2.8.0
message(STATUS
"The following is a developer warning - end users may ignore it")
message(STATUS "Dev Warning: ${_yourmsg}")
else()
message(AUTHOR_WARNING "${_yourmsg}")
endif()
endfunction()
This project is totally distinct from java_vrpn and the Vrpn server running on Android.
The Vrpn widgets for Android provide a set of Android Widgets that are bound to a Vrpn server. On the Android device, an application can be written mainly with Android XML layout, almost without Java coding. The documentation of the widgets is in android_widgets/vrpn_library/doc/
The Android application will send updates as UDP packets with a JSON payload to the vrpn_Tracker_JsonNet device. You need a VRPN server build with VRPN_USE_JSONNET and a vrpn.cfg file that declares a vrpn_Tracker_JsonNet device.
To build such a server you need JSONCPP. See README.jsoncpp for instructions about obtaining and building JSONCPP first, then use CMAKE to generate the VRPN project with VRPN_USE_JSONNET. You will need to define the JSONCPP_ROOT_DIR CMake variable.
Note :
the JSONNET server was built and tested only on Windows 7 32 bits, MSVC 2008
Philippe Crassous / Ensam ParisTech - Institut Image / 2011
p.crassous@free.fr
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="vrpn_library_src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>example_app</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>vrpn_library_src</name>
<type>2</type>
<locationURI>_android_vrpn_library_5bacf36/src</locationURI>
</link>
</linkedResources>
</projectDescription>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.app1"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" android:name="eu.ensam.ii.vrpn.VrpnApplication">
<activity android:name=".MainActivity" android:label="@string/app_name">
<intent-filter><action android:name="eu.ensam.ii.vrpn.STARTUI"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<data android:scheme="vrpn"></data>
</intent-filter><intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8"></uses-sdk>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
\ No newline at end of file
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-8
android.library.reference.1=../vrpn_library/
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
src/vrpn/android_widgets/example_app/res/drawable-hdpi/icon.png

4.05 KiB

src/vrpn/android_widgets/example_app/res/drawable-ldpi/icon.png

1.68 KiB

src/vrpn/android_widgets/example_app/res/drawable-mdpi/icon.png

2.51 KiB

<?xml version="1.0" encoding="utf-8"?>
<!--
The following line :
xmlns:app="http://schemas.android.com/apk/res/my.application.package
must be added after the xmlns:android line in the root widget.
It allows the use of the app: custom attributes
The list of these custom attributes is in vrpn_library/res/values/attrs.xml
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/test.app1"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/main_layout"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Lights"
/>
<eu.ensam.ii.vrpn.VrpnToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:vrpnButton="@id/VrpnButtonLightsOn"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Light intensity"
/>
<eu.ensam.ii.vrpn.VrpnSeekBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:minValue="0"
app:maxValue="255"
app:defaultValue="128"
app:vrpnAnalog="@id/VrpnAnalogLightIntensity"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Tracker"
/>
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id = "@+id/btnEnableTiltTracker"
/>
<eu.ensam.ii.vrpn.VrpnSpinner
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:prompt="@string/prompt_material"
android:entries="@array/array_materials"
app:vrpnAnalog="@id/VrpnAnalogMaterial"
/>
<eu.ensam.ii.vrpn.VrpnSurface
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background = "#444"
app:leftX="-1"
app:rightX="1"
app:topY="-1"
app:bottomY="1"
app:vrpnAnalogX="@id/VrpnAnalogSurfaceX"
app:vrpnAnalogY="@id/VrpnAnalogSurfaceY"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="array_materials">
<item>"Plastic"</item>
<item>"Gold"</item>
<item>"Wood"</item>
<item>"Silver"</item>
</string-array>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, MainActivity!</string>
<string name="app_name">vrpn-test</string>
<string name="prompt_material">Choose the material</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!--
Vrpn button numbers.
Keep them in a single file for easy reference and matching with your C++ code
-->
<resources>
<!-- For SeekBars and Spinners -->
<item type="id" format="integer" name="VrpnAnalogLightIntensity">0</item>
<item type="id" format="integer" name="VrpnAnalogSurfaceX">2</item>
<item type="id" format="integer" name="VrpnAnalogSurfaceY">3</item>
<item type="id" format="integer" name="VrpnAnalogMaterial">4</item>
<!-- For RadioButtons, PressButtons, ToggleButtons -->
<item type="id" format="integer" name="VrpnButtonLightsOn">0</item>
</resources>
package test.app1;
import java.net.InetAddress;
import java.net.UnknownHostException;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ToggleButton;
import eu.ensam.ii.vrpn.VrpnClient;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*
* The VrpnClient must be initialized before setContentView, since the views will
* trigger Vrpn updates with their initial value upon creation.
*/
/*
* The address of the Vrpn server
* When running on the emulator, 10.0.2.2 is loopback on the development machine
*/
InetAddress addr = null;
try {
//addr = InetAddress.getByName("192.168.173.1");
addr = InetAddress.getByName("10.0.2.2");
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*
* The Vrpn server port as defined in vrpn.cfg, on the line
* vrpn_Tracker_JsonNet 7777
*/
final int port = 7777;
VrpnClient.getInstance().setupVrpnServer(addr, port);
/*
* This layout in in res/layout/main.xml by default
*/
setContentView(R.layout.main);
/*
* Configure the button that controls the tracker
*/
final ToggleButton btn = (ToggleButton) findViewById(R.id.btnEnableTiltTracker);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
VrpnClient.getInstance().enableTiltTracker(btn.isChecked());
}
});
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="eu/ensam/ii/vrpn/views/VrpnHostActivity.java|eu/ensam/ii/vrpn/DebugSensors.java" kind="src" path="src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vrpn_library</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="eu.ensam.ii.vrpn">
<application android:icon="@drawable/icon" android:label="@string/app_name">
</application>
<uses-sdk android:minSdkVersion="8"></uses-sdk>
</manifest>
\ No newline at end of file