Skip to content

Instantly share code, notes, and snippets.

@mfe7
Last active May 11, 2022 12:15
Show Gist options
  • Save mfe7/c8b21b38a1574f6c319095415ae9a9e8 to your computer and use it in GitHub Desktop.
Save mfe7/c8b21b38a1574f6c319095415ae9a9e8 to your computer and use it in GitHub Desktop.
Connect Loomo to Ubuntu PC for ROS
It's relatively easy to just put the Loomo and PC on the same wifi network, start a ROS master on the PC, and pass messages.
But it's preferable to have a hard-wire connection between the two devices, since it should be faster and more relibale than WiFi.
In particular, we will use USB tethering from Android->PC in these instructions.
Note: This method allows the ROS master to be set either on PC or Android! And no root access needed on Android.
--------------------------------------------------
Switch Loomo into Developer Mode (Settings > System > Loomo Developer > Developer Mode)
- (I think this requires an internet connection, so join a wifi network now.)
You might need to switch Android into Developer Mode (tap some setting 7 times...look online for instructions).
Note: For the current version of the ROS node, it's very important that the Loomo *not* be connected to wifi,
because it'll try to use that interface (wlan0) for ROS msgs.
Connect USB cable from Loomo's USB-C port to PC's USB-A port.
On Loomo, turn on USB Tethering (Settings > Wireless & Networks > More... > Tethering & portable hotspot > USB tethering)
On Ubuntu, you should see a popup from NetworkManager saying there's a new Wired Connection. You can rename it to Loomo if you want.
At this point, the two devices are on a common network, and you should be able to ping one another.
To find their respective IP addresses:
On Ubuntu, run ifconfig - the entry corresponding to the Loomo connection on my PC is:
enp0s20f0u1u1u3 Link encap:Ethernet HWaddr 02:35:3b:38:39:72
inet addr:192.168.42.134 Bcast:192.168.42.255 Mask:255.255.255.0
inet6 addr: fe80::ca1a:cc4c:3bb1:600c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1112 errors:0 dropped:0 overruns:0 frame:0
TX packets:1368 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:185473 (185.4 KB) TX bytes:293926 (293.9 KB)
--> Ubuntu IP Address is 192.168.42.134
On Ubuntu, you can do a similar procedure to ask Android for its IP address.
$ adb shell netcfg
wlan0 DOWN 0.0.0.0/0 0x00001002 f4:4d:30:c0:90:d2
sit0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00
lo UP 127.0.0.1/8 0x00000049 00:00:00:00:00:00
rndis0 UP 192.168.42.129/24 0x00001043 1a:8d:e0:64:6a:5f
--> Android IP Address is 192.168.42.129
To verify the two are on the same network, you can ping each IP address from each device and will get responses.
So now that networking is set up, it's just a matter of setting up the ROS master.
On Ubuntu, you can just use localhost for the master (export ROS_MASTER_URI=http://localhost:11311/).
Go ahead and start a roscore on Ubuntu.
Now, on Android you can launch the android_tutorial_camera app (https://github.com/segway-robotics/vision_msg_proc),
and set the ROS master to the IP address of Ubuntu's USB interface (in my case, http://192.168.42.134:11311).
Click Connect on the android app.
On Ubuntu, you should now see several topics after $ rostopic list
At least on my Loomo, there are some issues with the vision-to-ROS conversion in Java, but I at least was able to publish a blank tf message and see it on Ubuntu!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment