This tutorial describes order to create a new project with own ROSjava nodes, similar description can be found also in the readme of demonodes project.
Multiproject Nengoros is compiled by means of the Gradle build tool. Template project can be found under the demonodes/templateProject. Copy the project under the folder nengoros, or use the script helper for this. The following tutorial expects that your project is under the nengoros folder and is named projectTemplate.
Building the project – Gradle basics:
In order to build your project, run from the root of your project:
To refresh (e.g. after renaming the folder) the eclipse project:
To install the project into the local maven repository:
Basically, such a new project depends on rosjava_core and jroscore projects, if these are installed in the local maven repository, the compilation should work well as it is.
Running the nodes independently
Since each ROSjava node produced in this way is 100% compatible with the ROS infrastructure, it can be launched either under roscore from ROS installation or jroscore from the nengoros project independently of the Nengo simulator (on Unix and Windows systems). To launch the node it is necessary to:
Create a runnable application by launching from the project root:
Run the core, e.g. for jroscore:
cd nengoros/jroscore && ./jroscore
Launch the generated script with the full node name in a new terminal:
cd nengoros/projectTemplate ./build/install/projectTemplate/bin/projectTemplate org.hanns.myPackage.DemoPublisher
Launch subscriber to receive messages in a new terminal:
cd nengoros/projectTemplate ./build/install/projectTemplate/bin/projectTemplate org.hanns.myPackage.DemoSubscriber
Now, there should be two independently running ROSjava nodes which communicate over the TCP/IP via the ROS network. Note that you can change some properties of nodes by adding optional command line arguments, for more information, see remapping arguments.
In case of you have ROS installed (e.g. Ubuntu), you can use the tool rqt to visualize the generated ROS network. To do this, run the rqt from new terminal (after the script is loaded in Nengo) and in the new GUI select: plugins/ROS Graph. The following visualization of ROS network should appear:
This ROS network shows communication graph of Publisher/Subscriber demo. Here, ellipses represent currently running ROS nodes, rectangles (containing only one string) represent used topics and the bigger rectangle represents namespace.
Running the nodes as a part of Nengoros
To see how to deploy project-specific data into Nengoros and how to use your nodes as a part of this project, continue to the following tutorial.