Skip to content

Commit

Permalink
Moving camera functionallity to its own App.
Browse files Browse the repository at this point in the history
  • Loading branch information
chadrockey committed Nov 12, 2012
0 parents commit abdf11c
Show file tree
Hide file tree
Showing 16 changed files with 1,032 additions and 0 deletions.
37 changes: 37 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.chadrockey.android.android_camera_driver"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="13" />

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:icon="@drawable/icon"
android:label="@string/app_name">
<!-- android:debuggable="true" -->
<activity
android:name="org.chadrockey.android.android_camera_driver.MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.ros.android.MasterChooser" />

<service android:name="org.ros.android.NodeMainExecutorService" />
</application>

</manifest>
39 changes: 39 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Authors:
chadrockey@gmail.com (Chad Rockey)
axelfurlan@gmail.com (Axel Furlan)

This is an extension to the first version of the Ros Android Sensors Driver.
It extends the driver to camera readings and updates the previous version to the post-gradle shift of the rosjava libs.
Two compression methods are currently supported, PNG and JPEG (with selectable compression quality).
The topic names are:


/camera/camera_info
/camera/image/compressed




Compiling:

To compile it on you machine, please follow the detailed instructions at:

Rosjava:
http://www.dobots.nl/blog/-/blogs/android-and-rosjava

Android OpenCV:
http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_binary_package.html

Once your environment is set, do the following steps:
1) git clone the repo in the android_core folder (the same folder where tutorials are).
2) Edit the settings.gradle file in the android_core folder, adding 'android_sensors_driver' at the end of the include list.
3) cd android_sensors_driver; ../gradlew clean debug

Install the appropriate OpenCV from Google Play.

For the whole process of building, packing, installing into the phone and running the app in debug mode, use the buildAll.sh script.

Known issues:

1) The code for raw images is also written, although the funcion is currently disabled due to OutOfMemory exceptions and lack of time to debug them. Any help is welcome.
2) A better UI would be needed, e.g. to set camera parameters (now everything is fixed at 640x480, far focus, ecc.)
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

dependencies {
compile 'ros.rosjava_core:rosjava_tutorial_pubsub:0.0.0-SNAPSHOT'
}


debug.dependsOn project(':android_gingerbread_mr1').tasks.debug

83 changes: 83 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="MainActivity" default="help">

<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />

<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />

<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />

<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"
/>

<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />

<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />

</project>
11 changes: 11 additions & 0 deletions buildAll.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Bash

../gradlew clean debug
if [ $? -eq 0 ]
then
adb uninstall org.chadrockey.android.android_camera_driver
adb install bin/MainActivity-debug.apk
adb shell am start -n org.chadrockey.android.android_camera_driver/org.chadrockey.android.android_camera_driver.MainActivity
adb logcat -c
adb logcat
fi
10 changes: 10 additions & 0 deletions local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/home/willow/NVPACK/android-sdk-linux
26 changes: 26 additions & 0 deletions mainpage.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
\mainpage
\htmlinclude manifest.html

\b android_camera_driver is ...

<!--
Provide an overview of your package.
-->


\section codeapi Code API

<!--
Provide links to specific auto-generated API documentation within your
package that is of particular interest to a reader. Doxygen will
document pretty much every part of your code, so do your best here to
point the reader to the actual API.

If your codebase is fairly large or has different sets of APIs, you
should use the doxygen 'group' tag to keep these APIs together. For
example, the roscpp documentation has 'libros' group.
-->


*/
9 changes: 9 additions & 0 deletions manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<package>
<description brief="android_camera_driver">
android_camera_driver
</description>
<author>Chad Rockey (chadrockey@google.com)</author>
<license>Apache 2.0</license>
<review status="unreviewed" notes="" />
<url>http://ros.org/wiki/android_camera_driver</url>
</package>
20 changes: 20 additions & 0 deletions proguard-project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
14 changes: 14 additions & 0 deletions project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-13
#android.library=true
android.library.reference.1=../android_gingerbread_mr1
android.library.reference.2=../../OpenCV-2.4.2-android-sdk/sdk/java
18 changes: 18 additions & 0 deletions res/layout/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<org.ros.android.view.camera.RosCameraPreviewView
android:id="@+id/ros_camera_preview_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

<org.ros.android.view.RosTextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="30dip" />

</LinearLayout>
4 changes: 4 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">ROS Android Camera Driver</string>
</resources>
Loading

0 comments on commit abdf11c

Please sign in to comment.