Native C++ with ROS on Android?

asked 2019-08-02 05:26:46 -0600

iliis gravatar image

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_..., 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?

edit retag flag offensive close merge delete

Comments

Hi! Have you found a solution to your problem? I'm facing a similar one.

peetonn gravatar imagepeetonn ( 2019-11-21 12:34:08 -0600 )edit

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.

iliis gravatar imageiliis ( 2019-11-21 12:47:05 -0600 )edit

could you share any pointers/notes on what you did? I'd appreciate any guidance...

peetonn gravatar imagepeetonn ( 2019-11-21 13:02:23 -0600 )edit

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... ;)

iliis gravatar imageiliis ( 2019-11-21 13:19:52 -0600 )edit

I have some experience with the above and cross-compiling as well.

peetonn gravatar imagepeetonn ( 2019-11-21 13:25:49 -0600 )edit

Well then. What do you actually, really need? If you justwant 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

iliis gravatar imageiliis ( 2019-11-21 13:32:55 -0600 )edit

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.

peetonn gravatar imagepeetonn ( 2019-11-22 12:10:27 -0600 )edit

I've wrote a longer answer to your question: https://answers.ros.org/question/3382...

iliis gravatar imageiliis ( 2019-11-26 04:29:55 -0600 )edit