GithubHelp home page GithubHelp logo

chadrockey / base_controller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adamantivm/base_controller

0.0 1.0 0.0 276 KB

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.

License: Apache License 2.0

Groovy 7.44% Java 76.41% Shell 16.15%

base_controller's Introduction

base_controller

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 built 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 an ROS Activity. For the Create base you should simple replace Kobuki with Create.

Import the USB library:

import com.hoho.android.usbserial.driver.UsbSerialDriver;
import com.hoho.android.usbserial.driver.UsbSerialProber;

Import the ROS nodes and the base drivers:

import com.github.c77.base_controller.BaseControllerNode;
import com.github.c77.base_controller.BaseStatusPublisher;
import com.github.c77.base_driver.KobukiBaseDevice;

You can instantiate the nodes when creating the Main ROS Activity:

public MainActivity() {
    super("MainActivity", "MainActivity");
    baseControllerNode = new BaseControllerNode("/cmd_vel");
    baseStatusPublisher = new BaseStatusPublisher();
}

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.
UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
// Find the first available driver.
UsbSerialDriver driver = UsbSerialProber.findFirstDevice(manager);
// Create the low level base device.
KobukiBaseDevice kobukiBaseDevice = new KobukiBaseDevice(driver);
baseControllerNode.setBaseDevice(kobukiBaseDevice);
baseStatusPublisher.setBaseDevice(kobukiBaseDevice);

After this point use the nodeMainExecutor to launch the nodes.

base_controller's People

Contributors

tulku avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.