You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This base controller for ROS on Android allows the user to drive the
Kobuki or Create bases from an Android device directly connected to the
desired base via USB.
Building
To build this package you can just use gradlew from the command line, or
you can put the package inside a catkin workspace and build it with
catkin_make.
Requirements
In order to use this code to drive a Create or a Kobuki base,
an Android device with USB On The Go (OTG) is needed. A
usb-otg cable
is also needed.
We tested this code in:
Nexus 7
Nexus 7 2013
Galaxy S4 Google Edition
Usage
These code fragments show how to use this package to create a
Kobuki driver in a ROS Activity. For the Create base you should simply
replace Kobuki with Create.
First, import the USB library. You can use the available Maven Artifact if you don't want to build it from source.
To do so, add the following dependency in your module's build.gradle:
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 list List<UsbSerialDriver> driverList = UsbSerialProber.getDefaultProber().findAllDrivers(usbManager); // Continue only if we have a single driver in the list if (driverList.isEmpty()) { thrownewException("No drivers found for the supplied USB device: " + device); }
// Use first available driver to get Port and Connection UsbSerialDriverdriver = driverList.get(0); UsbDeviceConnectionconnection = manager.openDevice(driver.getDevice()); UsbSerialPortport = driver.getPorts().get(0);
// Create the low level base device using the created Port and Connection BaseDevicekobukiBaseDevice = newKobukiBaseDevice(port, connection);
// Create the nodes using the Base Device BaseControllerNodebaseControllerNode = 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).
About
This base controller for ROS on Android allows the user to drive the Kobuki or Create bases from an Android device directly connected to the desired base via USB.