diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5cbed25e3ea63c69269d158e7543f51cb35bb619..8c1cd3d46807f6b8f575c96ff961d0d09c9e034e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,11 @@ Changelog ========= +0.3.0 (2016-12-13) +------------------ +* Updates for Kinetic release. +* NativeNodeMain for C++ node integration. + 0.2.1 (2015-02-25) ------------------ * allow setting of the talker topic name in pubsub tutorial. diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..163d4e98230101eb7caa9fde4c9c3d0a1cae8363 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +rosjava is the first pure Java implementation of ROS. + +From [ROS.org](http://www.ros.org/wiki/): ROS is an open-source, meta-operating +system for your robot. It provides the services you would expect from an +operating system, including hardware abstraction, low-level device control, +implementation of commonly-used functionality, message-passing between +processes, and package management. + +Developed at Google in cooperation with Willow Garage, rosjava enables +integration of Android and ROS compatible robots. This project is under active +development and currently alpha quality software. Please report bugs and feature +requests on the [issues +list](https://github.com/rosjava/rosjava/issues?state=open). + +To get started, visit the +[rosjava_core](http://rosjava.github.com/rosjava_core/latest) and +[android_core](http://rosjava.github.com/android_core/latest) pages for +documentation concerning the core libraries and examples. Also visit the roswiki +[rosjava](http://wiki.ros.org/rosjava) and +[android](http://wiki.ros.org/android) pages for more general rosjava-android +information. + +Still have questions? Check out the ros-users [discussion +list](https://discourse.ros.org/c/rosjava), post questions to [ROS +Answers](http://answers.ros.org/questions/) with the tag "rosjava," or join #ROS +on irc.oftc.net. + +rosjava was announced publicly during the [Cloud Robotics tech talk at Google +I/O 2011](http://www.youtube.com/watch?feature=player_embedded&v=FxXBUp-4800). + +Looking for a robot platform to experiment with ROS, Android, and cloud +robotics? The [OSRF](http://www.osrfoundation.org/) +[TurtleBot](http://wiki.ros.org/Robots/TurtleBot) is a great mobile perception +platform for [getting started with robotics +development](http://www.youtube.com/watch?feature=player_embedded&v=MOEjL8JDvd0). + +### Branches ### + +The master branch reflects the latest version of rosjava. All development +happens on the master branch in the form of pull requests from developers. +Unless you are developing rosjava itself, you should _not_ use the master +branch. + +Named branches are created whenever a new version of ROS is released. These +branches are considered stable. No new features will be added to these branches, +however, bug fixes may be cherry picked from master. + +### Pull Requests ### + +You must sign a Contributor License Agreement (CLA) before we can accept any +code. The CLA protects you and us. + +* If you are an individual writing original source code and you're sure you own + the intellectual property, then you'll need to sign an [individual + CLA](https://developers.google.com/open-source/cla/individual). +* If you work for a company that wants to allow you to contribute your work to + SL4A, then you'll need to sign a [corporate + CLA](https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Damon will respond on either github +or email to confirm. diff --git a/build.gradle b/build.gradle index fecfd7320a2fe2772f59cfdcc894f131a31195a5..995ed6b8f183b2a7c5fd2e4ec096bc5ea15e2991 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ task wrapper(type: Wrapper) { } buildscript { - apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/indigo/buildscript.gradle" + apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/kinetic/buildscript.gradle" } apply plugin: "catkin" @@ -31,16 +31,16 @@ allprojects { subprojects { if (name != 'docs') { - /* + /* * The ros plugin configures a few things: - * + * * - local deployment repository : where it dumps the jars and packaged artifacts) - * - local maven repositories : where it finds your locally installed/built artifacts) + * - local maven repositories : where it finds your locally installed/built artifacts) * - external maven repositories : where it goes looking if it can't find dependencies locally - * + * * To modify, or add repos to the default external maven repositories list, pull request against this code: - * - * https://github.com/rosjava/rosjava_bootstrap/blob/indigo/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy#L31 + * + * https://github.com/rosjava/rosjava_bootstrap/blob/kinetic/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy#L31 */ apply plugin: "ros-java" apply plugin: "osgi" diff --git a/docs/src/main/sphinx/installing.rst b/docs/src/main/sphinx/installing.rst index 0c456d31fcef359d44db65e40da275e5f647c4c9..336473930d881cdca504ddecb8e507a1d3790194 100644 --- a/docs/src/main/sphinx/installing.rst +++ b/docs/src/main/sphinx/installing.rst @@ -28,7 +28,7 @@ you simply need to clone the github repository git clone https://github.com/rosjava/rosjava_core cd rosjava_core - git checkout -b indigo origin/indigo + git checkout -b kinetic origin/kinetic and proceed immediately to the section on :ref:`building`. diff --git a/package.xml b/package.xml index 7c01807523c3dbda615db68f8624260b09d3e018..f46103c0723f5272650aa3443a4c03035f21fa96 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <package> <name>rosjava_core</name> - <version>0.2.1</version> + <version>0.3.0</version> <description> An implementation of ROS in pure-Java with Android support. </description> diff --git a/rosjava/build.gradle b/rosjava/build.gradle index 0ed5bb4c3a3e64a9100f0e98a4fcd02af2ba51e0..33867f8a4911a16748e9f42a563db78b2cc98d08 100644 --- a/rosjava/build.gradle +++ b/rosjava/build.gradle @@ -18,11 +18,11 @@ dependencies { compile project(':apache_xmlrpc_common') compile project(':apache_xmlrpc_server') compile project(':apache_xmlrpc_client') - compile 'org.ros.rosjava_bootstrap:message_generation:[0.2,0.3)' - compile 'org.ros.rosjava_messages:rosjava_test_msgs:[0.2,0.3)' + compile 'org.ros.rosjava_bootstrap:message_generation:[0.3,0.4)' + compile 'org.ros.rosjava_messages:rosjava_test_msgs:[0.3,0.4)' compile 'org.ros.rosjava_messages:rosgraph_msgs:[1.11,1.12)' - compile 'org.ros.rosjava_messages:geometry_msgs:[1.11,1.12)' - compile 'org.ros.rosjava_messages:nav_msgs:[1.11,1.12)' + compile 'org.ros.rosjava_messages:geometry_msgs:[1.12,1.13)' + compile 'org.ros.rosjava_messages:nav_msgs:[1.12,1.13)' compile 'org.ros.rosjava_messages:tf2_msgs:[0.5,0.6)' compile 'dnsjava:dnsjava:2.1.1' compile 'org.apache.commons:com.springsource.org.apache.commons.logging:1.1.1' diff --git a/rosjava/src/main/java/org/ros/node/NativeNodeMain.java b/rosjava/src/main/java/org/ros/node/NativeNodeMain.java new file mode 100644 index 0000000000000000000000000000000000000000..e483fa063d8fe73d7349a76ed7777eeafdbd09e3 --- /dev/null +++ b/rosjava/src/main/java/org/ros/node/NativeNodeMain.java @@ -0,0 +1,103 @@ +package org.ros.node; + +import org.ros.node.AbstractNodeMain; +import org.ros.node.ConnectedNode; +import org.ros.node.Node; +import org.ros.namespace.GraphName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.List; +import java.util.Map; + +/** + * A java wrapper to load and run a native-code ROS node. + * + * Note: there are no actual native methods declared in this class. We only define an interface. The native methods should be declared in the child class. + * + * @author ecorbellini@creativa77.com.ar (Ernesto Corbellini) + */ +public abstract class NativeNodeMain extends AbstractNodeMain { + + private Log log = LogFactory.getLog(NativeNodeMain.class); + private String libName; + private String masterUri = null; + private String hostName = null; + private String nodeName = null; + private String[] remappingArguments; + private boolean shuttingDown = false; + + /** + * @param libName + * The name of the library to load. + * + * @param remappings + * A string array with ROS argument remapping pairs in each element. + **/ + public NativeNodeMain(String libName, String[] remappings) { + this.libName = libName; + + // if no remapping is needed, create an empty array + if (remappings == null) { + remappingArguments = new String[0]; + } + + log.info("Trying to load native library '" + libName + "'..."); + try + { + System.loadLibrary(libName); + } + catch (SecurityException e) + { + log.info("Error loading library! SecurityException"); + } + catch (UnsatisfiedLinkError e) + { + log.info("Error loading library! UnsatisfiedLinkError"); + } + catch (NullPointerException e) + { + log.info("Error loading library! NullPointerException"); + } + } + + /** + * @param libName + * The name of the library to load. + **/ + public NativeNodeMain(String libName) { + this(libName, null); + } + + // These methods define the execution model interface for this node. + protected abstract void execute(String rosMasterUri, String rosHostName, String rosNodeName, String[] remappingArguments); + protected abstract void shutdown(); + + @Override + public void onStart(final ConnectedNode connectedNode) { + // retain important ROS info + masterUri = connectedNode.getMasterUri().toString(); + hostName = connectedNode.getUri().getHost(); + nodeName = this.libName; + + // create a new thread to execute the native code. + new Thread() { + @Override + public void run() { + execute(masterUri, hostName, nodeName, remappingArguments); + + // node execution has finished so we propagate the shutdown sequence only if we aren't already shutting down for other reasons + if(!shuttingDown) { + connectedNode.shutdown(); + } + } + }.start(); + } + + @Override + public void onShutdown(Node node) { + shuttingDown = true; + shutdown(); + } +} diff --git a/rosjava_tutorial_right_hand_rule/build.gradle b/rosjava_tutorial_right_hand_rule/build.gradle index 907db0229474ef1292591119a70942924a24345b..c48db93699b911fb7cf9fd3e85ac5ed4301797fa 100644 --- a/rosjava_tutorial_right_hand_rule/build.gradle +++ b/rosjava_tutorial_right_hand_rule/build.gradle @@ -20,6 +20,6 @@ mainClassName = 'org.ros.RosRun' dependencies { compile project(':rosjava') - compile 'org.ros.rosjava_messages:sensor_msgs:[1.11,1.12)' + compile 'org.ros.rosjava_messages:sensor_msgs:[1.12,1.13)' }