{"id":21627244,"url":"https://github.com/sloretz/sensors_for_ros","last_synced_at":"2026-03-06T08:02:04.104Z","repository":{"id":52184070,"uuid":"476848954","full_name":"sloretz/sensors_for_ros","owner":"sloretz","description":"An Android app that publishes sensor and camera data on ROS 2 topics","archived":false,"fork":false,"pushed_at":"2024-04-02T16:45:29.000Z","size":211,"stargazers_count":92,"open_issues_count":10,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T09:04:04.056Z","etag":null,"topics":["android","ros-humble","ros2"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sloretz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-01T19:44:07.000Z","updated_at":"2025-03-18T09:13:29.000Z","dependencies_parsed_at":"2023-01-19T22:45:38.842Z","dependency_job_id":null,"html_url":"https://github.com/sloretz/sensors_for_ros","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloretz%2Fsensors_for_ros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloretz%2Fsensors_for_ros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloretz%2Fsensors_for_ros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloretz%2Fsensors_for_ros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sloretz","download_url":"https://codeload.github.com/sloretz/sensors_for_ros/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248402545,"owners_count":21097331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ros-humble","ros2"],"created_at":"2024-11-25T01:15:55.932Z","updated_at":"2026-03-06T08:01:59.072Z","avatar_url":"https://github.com/sloretz.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sensors for ROS\n\nSensors for ROS is an app that publishes sensor data from an Android device onto ROS 2 topics.\nCurrently it supports ROS Humble.\n\n**Supported sensors**\n* Accelerometer\n* Barometer\n* Camera(s)\n* Gyroscope\n* Illuminance\n* Magnetometer\n\nThis app is built using only CMake and C++.\nIt does not use Java or Kotlin.\nROS 2 packages up to `rclcpp` are cross-compiled.\nA successful build produces an `.apk` file called `sensors_for_ros.apk` in the build directory.\n\n## Inspiration\n\nThese projects were extremely helpful, and used as a reference for this one:\n\n* https://github.com/cnlohr/rawdrawandroid\n* https://github.com/ocornut/imgui/tree/master/examples/example_android_opengl3\n* https://www.sisik.eu/blog/android/ndk/camera\n\n## How to install it\n\nCurrently the only way to get **Sensors for ROS** is to build it from source.\nIt is not yet available on Google's app store.\n\n## How to build it from source\n\nYou do not need ROS installed on your machine to build the **Sensors for ROS** app.\nHowever, it's needed to use the sensor data being published by your Android device.\nFollow [these instructions to install ROS Humble](https://docs.ros.org/en/humble/Installation.html).\n\n### Computer setup\n\nDownload the [Android SDK \"Command-line tools only\" version](https://developer.android.com/studio#command-tools).\nOther versions may work, but this is the minimum needed.\n\nMake a folder for the SDK and extract the archive.\n\n```bash\nmkdir ~/android-sdk\ncd ~/android-sdk\nunzip ~/Downloads/commandlinetools-linux-8512546_latest.zip\n```\n\nInstall some Android SDK components\n(If it gives linkage error try installing `sudo apt install openjdk-17-jre-headless`)\n```\n./cmdline-tools/bin/sdkmanager --sdk_root=$HOME/android-sdk \"build-tools;33.0.0\" \"platforms;android-30\" \"ndk;25.1.8937393\"\n```\n\nInstall `adb`\n\n```bash\n# If you're using Ubuntu\nsudo apt install adb android-sdk-platform-tools-common\n# If you're using Fedora\nsudo dnf install android-tools\n```\n\nInstall catkin-pkg, empy, and lark\n\n```bash\n# If you're using ubuntu\nsudo apt install python3-catkin-pkg-modules python3-empy python3-lark-parser\n# If you're using Fedora\nsudo dnf install python3-catkin_pkg python3-empy python3-lark-parser\n```\n\nYou may need to do additional setup to use adb.\nFollow the [Set up a device for development](https://developer.android.com/studio/run/device#setting-up) instructions if you're using Ubuntu, or follow [the instructions in this thread](https://forums.fedoraforum.org/showthread.php?298965-HowTo-set-up-adb-(Android-Debug-Bridge)-on-Fedora-20) if you're using Fedora.\n\n\n### Create debug keys\n\nYou'll need to install openjdk to get access to `keytool`.\n\n```bash\nsudo apt install openjdk-11-jre-headless\n```\n\nCreate a debug keystore\n\n```bash\nmkdir ~/.android\nkeytool -genkey -v -keystore ~/.android/debug.keystore -alias adb_debug_key -keyalg RSA -keysize 2048 -validity 10000 -storepass android -keypass android\n```\n\n### Clone the repo\n\nThe official repo is [`sloretz/sensors_for_ros`](https://github.com/sloretz/sensors_for_ros).\n\n```\ngit clone https://github.com/sloretz/sensors_for_ros.git\n```\n\nNext initialize the git submodules.\n\n```bash\ngit submodule init\ngit submodule update\n```\n\n### Download ROS dependencies\n\nUse [vcstool](https://github.com/dirk-thomas/vcstool) to download the ROS packages we need to cross compile into the `deps` folder.\n\n```\nvcs import --input ros.repos deps/\n```\n\n### Building the App\n\nBuild the software\n\n```\nmkdir build\ncd build\ncmake ../ -DANDROID_HOME=$HOME/android-sdk/\nmake -j`nproc`\n```\n\n### Installing the App on your Android Device\n\nInstall the APK in the build directory onto a device.\n\n```\nadb install -r sensors_for_ros.apk\n```\n\n## Development tips\n\nUse logcat to view the logs from the app\n```\nadb logcat\n```\n\nSometimes you may want to try out a permission without writing the code to request it.\nThe app must be installed, but not running already for this command to work.\n```\nadb shell pm grant com.github.sloretz.sensors_for_ros android.permission.CAMERA\n```\n\nThe main activity can be started directly from the CLI\n```\nadb shell am start -n com.github.sloretz.sensors_for_ros/android.app.NativeActivity\n```\n\nGetting stack traces\n\n```\nadb logcat | $HOME/android-sdk/ndk/*/ndk-stack -sym lib/arm64-v8a/\n```\n\n# Random lessons\n\nDuring development I documented problems I encountered and fixes for them in the [Problems Encountered](docs/problems_encountered.md) document.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloretz%2Fsensors_for_ros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsloretz%2Fsensors_for_ros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloretz%2Fsensors_for_ros/lists"}