In the init method of your RosActivity, use the USB library to find a driver, get a port and a connection.
Then, use them to create the Base Devices required to instantiate the nodes:

// Get UsbManager from Android.UsbManagermanager=(UsbManager)getSystemService(Context.USB_SERVICE);// Get a driver listList<UsbSerialDriver>driverList=UsbSerialProber.getDefaultProber().findAllDrivers(usbManager);// Continue only if we have a single driver in the listif(driverList.isEmpty()){thrownewException("No drivers found for the supplied USB device: "+device);}// Use first available driver to get Port and ConnectionUsbSerialDriverdriver=driverList.get(0);UsbDeviceConnectionconnection=manager.openDevice(driver.getDevice());UsbSerialPortport=driver.getPorts().get(0);// Create the low level base device using the created Port and ConnectionBaseDevicekobukiBaseDevice=newKobukiBaseDevice(port,connection);// Create the nodes using the Base DeviceBaseControllerNodebaseControllerNode=newBaseControllerNode(kobukiBaseDevice,"/cmd_vel");BaseStatusPublisherbaseStatusPublisher=newBaseStatusPublisher(kobukiBaseDevice);

After this point, use the nodeMainExecutor to launch the nodes in the standard Rosjava way.

Maven Artifact

You can use base_controller in your project using the available Maven Artifact instead of building it from source.
To do so, add the following dependency to your modules's build.gradle:

Note: to do this, the rosjava_mvn_repo should be available in your listed repositories.
The easiest way to ensure it is using the kinetic standard top-level build.gradle in your project (you can use base_controller's build.gradle as an example).

CHANGELOG

Changelog for package base_controller

0.2.0 (2017-02-22)

Using the latest version of UsbSerialLibrary from public repository.

Refactored com.github.c77 package name to com.ekumen.

Corrected package name in manifest.

Updated rosjava dependency to [0.3, 0.4)

Dev: Higher odom publish frequency & tf child frame renamed

Odom publish rate changed to 100 Hz using ROS functions. base_link
changed to base_footprint (odometry should be published against a
frame at ground level)

Feature: safe stop

Added safe stop in case cmd_vel are lost for a period of time (1s).

Upgrade: new buildscripts and Kinetic dependencies

Update rosjava bootsrap required version to current version

Depend on catkinized hoho USB library.

Update the usb library to work with the laser. Added a TODO note to
remind us of changing the Laser link tf broadcasting.

In the init method of the Node, we use the USB library to find the device and create the base driver.
After creating the base driver, we can set the device to the two nodes.

// Get UsbManager from Android.UsbManagermanager=(UsbManager)getSystemService(Context.USB_SERVICE);// Find the first available driver.UsbSerialDriverdriver=UsbSerialProber.findFirstDevice(manager);// Create the low level base device.KobukiBaseDevicekobukiBaseDevice=newKobukiBaseDevice(driver);baseControllerNode.setBaseDevice(kobukiBaseDevice);baseStatusPublisher.setBaseDevice(kobukiBaseDevice);