diff --git a/.gitignore b/.gitignore index ba97d94..b98fe6f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /.idea/workspace.xml /build .DS_Store + +.idea \ No newline at end of file diff --git a/build.gradle b/build.gradle index c7b9115..eb48bb8 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,10 @@ buildscript { repositories { mavenCentral() + jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:2.3.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -19,5 +20,6 @@ allprojects { name "rosjava-github" url "https://github.com/rosjava/rosjava_mvn_repo/raw/master" } + jcenter() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 582438d..8fece65 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Dec 05 12:41:53 CET 2014 +#Sat Apr 08 11:19:15 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/libraries/libraries.iml b/libraries/libraries.iml new file mode 100644 index 0000000..d36a528 --- /dev/null +++ b/libraries/libraries.iml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/rosandroid-core/build.gradle b/libraries/rosandroid-core/build.gradle index ec72567..cc7c1b6 100644 --- a/libraries/rosandroid-core/build.gradle +++ b/libraries/rosandroid-core/build.gradle @@ -1,8 +1,8 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 14 + buildToolsVersion '25.0.0' } configurations { @@ -10,14 +10,11 @@ configurations { } dependencies { - compile('org.ros.rosjava_core:rosjava:0.2.1') { exclude group: 'xml-apis' exclude group: 'junit' } - compile 'org.ros.rosjava_messages:std_msgs:0.5.9' compile 'org.ros.rosjava_messages:rosgraph_msgs:1.11.1' compile 'org.ros.rosjava_messages:sensor_msgs:1.11.7' - } diff --git a/libraries/rosandroid-core/rosandroid-core.iml b/libraries/rosandroid-core/rosandroid-core.iml new file mode 100644 index 0000000..ce2ae2c --- /dev/null +++ b/libraries/rosandroid-core/rosandroid-core.iml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rosandroid-example-app/build.gradle b/rosandroid-example-app/build.gradle index 962d6ab..bc42ddf 100644 --- a/rosandroid-example-app/build.gradle +++ b/rosandroid-example-app/build.gradle @@ -1,16 +1,15 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" - + compileSdkVersion 14 + buildToolsVersion '25.0.0' defaultConfig { - applicationId "org.ollide.rosandroid" + applicationId 'org.ollide.rosandroid' // Android 4.0+ http://dannyroa.com/2013/10/17/why-its-time-to-support-only-android-4-0-and-above minSdkVersion 14 - targetSdkVersion 22 + targetSdkVersion 14 versionCode 1 - versionName "1.0" + versionName '0.1' } buildTypes { release { @@ -18,16 +17,16 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - packagingOptions { /* https://github.com/rosjava/android_core/issues/194 */ exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } + productFlavors { + } } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - + compile fileTree(include: ['*.jar'], dir: 'libs') compile project(':libraries:rosandroid-core') } diff --git a/rosandroid-example-app/rosandroid-example-app.iml b/rosandroid-example-app/rosandroid-example-app.iml new file mode 100644 index 0000000..a20a09b --- /dev/null +++ b/rosandroid-example-app/rosandroid-example-app.iml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rosandroid-example-app/src/main/java/org/ollide/rosandroid/MainActivity.java b/rosandroid-example-app/src/main/java/org/ollide/rosandroid/MainActivity.java index 6180530..f95815a 100644 --- a/rosandroid-example-app/src/main/java/org/ollide/rosandroid/MainActivity.java +++ b/rosandroid-example-app/src/main/java/org/ollide/rosandroid/MainActivity.java @@ -38,11 +38,14 @@ protected void onCreate(Bundle savedInstanceState) { @Override protected void init(NodeMainExecutor nodeMainExecutor) { - NodeMain node = new SimplePublisherNode(); - NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress()); nodeConfiguration.setMasterUri(getMasterUri()); + NodeMain node = new SimplePublisherNode(); nodeMainExecutor.execute(node, nodeConfiguration); + + + NodeMain node2 = new SimpleSubscriberNode(); + nodeMainExecutor.execute(node2, nodeConfiguration); } } diff --git a/rosandroid-example-app/src/main/java/org/ollide/rosandroid/SimpleSubscriberNode.java b/rosandroid-example-app/src/main/java/org/ollide/rosandroid/SimpleSubscriberNode.java new file mode 100644 index 0000000..09951d1 --- /dev/null +++ b/rosandroid-example-app/src/main/java/org/ollide/rosandroid/SimpleSubscriberNode.java @@ -0,0 +1,36 @@ +package org.ollide.rosandroid; + +import android.util.Log; + +import org.ros.message.MessageListener; +import org.ros.namespace.GraphName; +import org.ros.node.AbstractNodeMain; +import org.ros.node.ConnectedNode; +import org.ros.node.NodeMain; +import org.ros.node.topic.Subscriber; + +/** + * Created by maximilianporzelt on 08.04.17. + * Note: http://rosjava.github.io/rosjava_core/0.1.6/getting_started.html + */ + +public class SimpleSubscriberNode extends AbstractNodeMain implements NodeMain { + + private static final String TAG = SimpleSubscriberNode.class.getSimpleName(); + + @Override + public GraphName getDefaultNodeName() { + return GraphName.of("SimpleSubscriberNode/ListenerNode"); + } + + @Override + public void onStart(ConnectedNode connectedNode) { + Subscriber subscriber = connectedNode.newSubscriber("chatter", std_msgs.String._TYPE); + subscriber.addMessageListener(new MessageListener() { + @Override + public void onNewMessage(std_msgs.String message) { + Log.i(TAG, "I heard: \"" + message.getData() + "\""); + } + }); + } +} diff --git a/rosjava_android_template.iml b/rosjava_android_template.iml new file mode 100644 index 0000000..cf58a0b --- /dev/null +++ b/rosjava_android_template.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file