Debug logging of micro-ROS on Android
I have an application for Android written in C++ which I want to connect with the ROS 2 world using micro-ROS, which is said to support Android out of the box. I had many issues using the standard 'android generic' configuration so in the end I created a custom Android configuration for a 'generate_lib' build and linked the resulting library archive to the usual Gradle + CMake build. This works quite nicely as far as building is concerned.
However, I have problems running the simple string publisher code. The program fails right at the beginning during initialization inside rclc_support_init call (I manually traced it a bit further down to rmw_init inside rcl_init). Unfortunately, I could get no indication as to what exactly is failing due to logging being apparently disabled by default for rcl, at least in this build. I tried, to no avail, to enable it by doing the following:
- defined
RCL_LOGGING_ENABLED=ONforrclin colcon.meta, - included
spdlog_vendorinsidemcu_wsworkspace
This seems to build the logging infrastructure but I still get no logging output.
What else do I need to do to get the logging output from rcl?
Asked by kvik on 2022-05-06 04:31:58 UTC
Answers
Hello @kvik, where is it said that Android is supported out of the box?
Where are you running the micro-ROS Agent?
Could you please open an issue in the Github repo you are using in order to allow us to track this issue?
Asked by Pablogs on 2022-05-09 01:25:57 UTC
Comments
Android is listed in the "Supported platforms" table in the micro_ros_setup README. It does say, in footnote, that it's only community supported but at the time I didn't let that comment detract from my optimism.
In any case, I did manage to debug the issue and had successfully connected to ROS 2 world from Android using micro-ROS. The issue turned out to be a couple of fairly stupid things combined: firstly, I forgot to add the INTERNET permission to my Android app, secondly I was trying to connect to the agent while on a different Wi-Fi network. Both of these would have become immediately obvious have I managed to turn on the logging somehow -- which, btw, I still haven't figured out.
When I find a bit of time I will be submitting my generate_lib config for Android and I'll try to figure out how the android generic build is supposed to work while fixing it as well.
Asked by kvik on 2022-05-10 12:37:11 UTC
Nice thanks!
Asked by Pablogs on 2022-05-11 07:23:50 UTC
Comments