ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Android and ROS communication (Bluetooth or USB)

asked 2014-11-04 11:09:15 -0600

hiro64 gravatar image

updated 2014-11-06 09:12:06 -0600

Hello,

I have been trying lately to connect a ROS core in my laptop with a ROS android app on my Galaxy Tab 2. Wi-fi is not possible because we do not have internet in the places where we need to move the robot. So I have tried to connect via USB, as I read that through USB tethering one could confirm this connection. However, I could not succeed in this, as the tablet does connect to the core, but does not appear to the master at the laptop (the topics and nodes from the android app do not appear as they do when using wi-fi).

Is there any more information about how to do this connection via USB? Or maybe through bluetooth, which I didn't find any at all.

Thanks.

edit retag flag offensive close merge delete

Comments

Through USB I couldn't get it working any way, either through tethering or reverse tethering. WIth Bluetooth, I tried to use the Bluetooth Manager to share a connection from the PC, but also to no avail.

hiro64 gravatar image hiro64  ( 2014-11-14 11:00:42 -0600 )edit

So I ended up connecting them through a hotspot created by another Android device, without any data connection involved, which finally did work. However, this is not an answer to my question, which was about USB or Bluetooth, so I'll just keep it here as an alternative solution.

hiro64 gravatar image hiro64  ( 2014-11-14 11:02:13 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2014-11-04 11:40:38 -0600

paulbovbel gravatar image

updated 2014-11-04 15:19:30 -0600

Sounds like you need to check your network configuration to get tethering to work properly. Does the connection show up in ifconfig?

It's possible tethering is disabled/crippled on the tablet by the manufacturer as it was on my Nexus 10, since a tablet doesn't have cellular internet and therefore doesn't need to provide tethering for a typical end-user.

In that case you can check out if the cyanogenmod distribution for your device enables it. If it doesn't, you can build the kernel from source and enable tethering yourself ( http://forum.xda-developers.com/showt... ).

If you get tethering working, you can also setup reverse tethering ( http://forum.xda-developers.com/showt... ). With reverse tethering, your tablet uses the PC as the host, which makes more sense for most use cases with ROS. Automating this to be on connect would involve running some adb shell commands in a script on the pc, triggered by udev.

If you find tethering STILL doesn't work, you can try to get something working with the adb ppp command ( http://stackoverflow.com/questions/45... ), though I found this to be really temperamental and not supported on many devices.

edit flag offensive delete link more

Comments

The connection does show up in ifconfig. I should try your other suggestions, thank you.

hiro64 gravatar image hiro64  ( 2014-11-06 09:10:13 -0600 )edit

What's your full network setup. Are the two connected to each other in isolation (i.e. the computer is not connected to any other device)?

paulbovbel gravatar image paulbovbel  ( 2014-11-06 09:12:51 -0600 )edit

Yes. When I try to tether the tablet with the laptop (Ubuntu), it appears as a Wired Connection. Then I disconnect from the other connections and connect only with this Wired Connection.

hiro64 gravatar image hiro64  ( 2014-11-06 09:17:51 -0600 )edit

So, if it shows up in ifconfig, the network connection exists. Your problem probably lies in network setup. If you're tethering, the tablet acts as a dhcp host and assigns an IP address to your pc. Make sure you can ping the pc from the tablet shell and vice versa.

paulbovbel gravatar image paulbovbel  ( 2014-11-06 09:21:38 -0600 )edit

If you setup reverse tethering, the guide shows you how to do it with static ips, however you could also setup your laptop to act as a dhcp host.

paulbovbel gravatar image paulbovbel  ( 2014-11-06 09:22:00 -0600 )edit

So, reverse tethering only worked when the notebook was connected to the internet. Otherwise, the topics simply don't appear to the master, even though the ROS android app does connect normally.

hiro64 gravatar image hiro64  ( 2014-11-11 08:53:03 -0600 )edit

i would guess that that's due to something in your network config. I did this on a headless install of ubuntu (so no network manager), and bridged the pc's usb and wifi network interface, letting a router act as the dhcp host, so I didn't exactly follow the guide i linked on the PC side.

paulbovbel gravatar image paulbovbel  ( 2014-11-11 09:25:44 -0600 )edit
3

answered 2014-11-04 11:15:31 -0600

Wolf gravatar image

What about setting up a WiFi access point or hotspot on your robot an connect your tablet with this access point in a local network (no internet required if you just whish to connect them both)

edit flag offensive delete link more

Comments

1

If you have wifi on your robot, I would suggest running the hotspot on the tablet. Ubuntu hotspots run in ad-hoc mode, which Android does not support connecting to.

paulbovbel gravatar image paulbovbel  ( 2014-11-04 11:45:10 -0600 )edit

I tried both ways, but it still didn't work. They connect to each other and even show up in the connected devices list, but no nodes or topics from the android device appear to the master at the laptop.

hiro64 gravatar image hiro64  ( 2014-11-06 09:09:15 -0600 )edit

You should probably get this option working and get familiar with rosjava before going the usb tethering route, which is more troublesome to config properly.

paulbovbel gravatar image paulbovbel  ( 2014-11-06 12:55:32 -0600 )edit
1

answered 2014-11-21 08:55:35 -0600

chris_amelinckx gravatar image

updated 2014-11-21 08:56:10 -0600

Hi hiro64, you might want to check my answer here: http://answers.ros.org/question/19762...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-11-04 11:09:15 -0600

Seen: 4,599 times

Last updated: Nov 06 '14