Native C++ with ROS on Android?
I'd like to run our existing ROS nodes on Android. This is all C++ code, and I've got the non-ROS parts working with the Android NDK already. However, using native ROS on Android doesn't seem very straightforward. I've found https://github.com/ekumenlabs/roscpp_android, but this is for ROS Hydro and NDK r9!
Any suggestions on running ROS Melodic (or later) with NDK r20? Do I really have to cross-compile the full ROS core myself, including all the dependencies? This is quite a bit of work. It includes cross-compiling python 2 for Android which isn't trivial itself. I was hoping to find something precompiled or at least pre-configured...
I don't think it makes sense to use rosjava, as then we would basically have to rewrite all our ROS code, no?
Might it make sense to migrate to ROS 2?
Asked by iliis on 2019-08-02 05:26:46 UTC
Comments
Hi! Have you found a solution to your problem? I'm facing a similar one.
Asked by peetonn on 2019-11-21 13:34:08 UTC
Only partially and it's quite a bit of work: I've crosscompiled every C++ package I need into a bunch of libraries which I then include in my Android NDK app. You can easily include catkin packages in a normal CMakeLists.txt (which is what the Android NDK uses). This gives me all the functionality I need (mainly publishing and subscribing to topics), but it requires cross-compilation of a few dozen libraries (both ROS and its dependencies, some of which required a few fixes) and I don't have any python running at all, so things like "rostopic list" or anything else that relies on a full workspace like rospack don't work.
Asked by iliis on 2019-11-21 13:47:05 UTC
could you share any pointers/notes on what you did? I'd appreciate any guidance...
Asked by peetonn on 2019-11-21 14:02:23 UTC
That heavily depends on how familiar you are with cmake, catkin and cross-compiling in general. Also, it's definitely not for the faint of heart... ;)
Asked by iliis on 2019-11-21 14:19:52 UTC
I have some experience with the above and cross-compiling as well.
Asked by peetonn on 2019-11-21 14:25:49 UTC
Well then. What do you actually, really need? If you just want to send and receive ROS messages on Android, then the rosjava stuff is by far the easiest thing to use: http://wiki.ros.org/android_core
Asked by iliis on 2019-11-21 14:32:55 UTC
I can't do Java since I have C++ library. This library is used in third-party framework (UnrealEngine). Yes, I need to create topics and publish to them, and subscribe to two topics.
Asked by peetonn on 2019-11-22 13:10:27 UTC
I've wrote a longer answer to your question: https://answers.ros.org/question/338249/using-roscpp-in-existing-app-on-androidios/?answer=338601#post-id-338601
Asked by iliis on 2019-11-26 05:29:55 UTC