-
Notifications
You must be signed in to change notification settings - Fork 20
how to configure rosjava apps with gradle
Two ways to develop Android apps with rosjava.
You can build the multiple rosjava packages in one shot; running catkin_make, at the catkin workspace.
Refer to this link.
Build scripts pull in maven to your project, requiring no rosjava core library. Supports development on Windows.
Refer to this link.
Download and install Android Studio.
Prepare any of the following APIs.
- API 10 (Gingerbread)
- API 13 (Honeycomb)
- API 15 (Ice Cream)
- API 18 (Jellybean)
$ mkdir -p ~/YOUR_WORKSPACE/src
$ cd src
# catkin_create_android_pkg [package name] [dependecy 1] [dependecy 2] ..
$ catkin_create_android_pkg test_pkg android_core rosjava_core std_msgs
$ cd test_pkg
# catkin_create_android_project [-t TARGET_VERSION] [-p ANDROID_PACKAGE_NAME] [-a AUTHOR] [NAME]
$ catkin_create_android_project -t 13 -p com.github.irvs.ros_tms.test_project test_project
$ cd ../..
$ catkin_make
Then the package has CMakeLists.txt
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(android_extras)
find_package(catkin REQUIRED rosjava_build_tools)
catkin_android_setup(assembleRelease uploadArchives)
catkin_package()
Create a new project on Android Studio.
Utilize remote dependencies.
Add repositories.
repositories {
maven {
url 'https://github.com/rosjava/rosjava_mvn_repo/raw/master'
}
mavenCentral()
}
Add dependecies.
Some "exclude group:" are a workaround for this issue
dependencies {
compile ('org.ros.android_core:android_honeycomb_mr2:[0.1,0.2)') {
exclude group: 'junit'
exclude group: 'xml-apis'
}
// e.g. official msgs
compile 'org.ros.rosjava_messages:std_msgs:[0.1,)'
compile 'org.ros.rosjava_messages:sensor_msgs:[0.1,)'
compile 'org.ros.rosjava_messages:geometry_msgs:[0.1,)'
}
Add packagingOptions (license)
android.packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
Add the permission below.
<uses-permission android:name="android.permission.INTERNET" />
Add MasterChooser and NodeMainExecutor
<!-- To set up the connection to the master -->
<activity android:name="org.ros.android.MasterChooser" />
<!-- To manage to execute nodes like the node handler -->
<service android:name="org.ros.android.NodeMainExecutorService" >
<intent-filter>
<action android:name="org.ros.android.NodeMainExecutorService" />
</intent-filter>
</service>
Sync your project with gradle files.
package ...;
import ...
// Do not extend Activity, but RosActivity!
public class MainActivity extends RosActivity{
public MainActivity() {
super("Example", "Example");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
// A unique part for ROS
}
}
public class ExampleNode implements AbstractNodeMain {
// To be seen by RosCore
@Override
public GraphName getDefaultNodeName() {
return GraphName.of("ExampleNode");
}
@Override
public void onStart(final ConnectedNode connectedNode) {
// Define any publishers, subscribers, servers or clients..
}
@Override
public void onShutdown(Node node) {
//
}
@Override
public void onShutdownComplete(Node node) {
//
}
}
public class MainActivity extends RosActivity{
...
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
ExampleNode exampleNode = new ExampleNode(this);
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(
InetAddressFactory.newNonLoopback().getHostAddress());
nodeConfiguration.setMasterUri(getMasterUri());
nodeMainExecutor.execute(exampleNode, nodeConfiguration);
}
}
ROS wiki - rosjava
ROS wiki - ROS Development Environment
ROS wiki - Android Studio Development Environment
GitHub rosjava_core - Latest official documentation
GitHub rosjava_core - Overview summery
ROS-TMS
Messages of ROS-TMS
Database
Task Scheduler
Robot Controller
Robot Motion Planning
Robot Service
Sensor Drive
Sensor System
- tms_ss_fss
- tms_ss_his
- tms_ss_ics
- tms_ss_ods
- tms_ss_vicon
- tms_ss_vs
- tms_ss_pot
- tms_ss_nfbed
- tms_ss_whs1
- tms_ss_pozyx
State Analyzer
User Request
Network module for Hierarchical ROS-TMS
ROS-TMS Developer
ETC.