学习笔记之——基于ROS的Android开发
之前博客已经介绍了在linux下安装Android studio《基于linux系统安装Android Studio》,同时也实现了用手机控制turtlebot3的移动。本博文来系统性的学习一下Android与ROS联合开发~
目录
ROSJAVA
ROSjava为ros在java中的通信提供了一个客户端库,以及一系列的核心工具及驱动
ROSAndroid
ROS与Android项目
github工程https://github.com/ros-autom/RobotCA/tree/kinetic/src/android_foo是一款可以控制机器人的APP。但是配置起来有点麻烦~~~
首先有些网页在大陆访问比较困难,为此修改build.gradle文件
/*
* Copyright (C) 2014 Mike
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
task wrapper(type: Wrapper) {
gradleVersion = '2.2.3'
}
buildscript {
// apply from: "https://github.com/rosjava/android_core/raw/kinetic/buildscript.gradle"
// apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/kinetic/buildscript.gradle"
String rosMavenPath = System.getenv("ROS_MAVEN_PATH")
String rosMavenRepository = System.getenv("ROS_MAVEN_REPOSITORY")
repositories {
if (rosMavenPath != null) {
rosMavenPath.tokenize(":").each { path ->
maven {
// We can't use uri() here because we aren't running inside something
// that implements the Script interface.
url "file:${path}"
}
}
}
maven {
url "http://repository.springsource.com/maven/bundles/release"
}
maven {
url "http://repository.springsource.com/maven/bundles/external"
}
if (rosMavenRepository != null) {
maven {
url rosMavenRepository
}
}
maven {
url "https://github.com/rosjava/rosjava_mvn_repo/raw/master"
}
// google()
maven {
url 'https://maven.google.com'
}
jcenter()
}
dependencies {
classpath "org.ros.rosjava_bootstrap:gradle_plugins:[0.3,0.4)"
}
dependencies {
classpath "com.android.tools.build:gradle:3.2.1"
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
dependencies {
//Add this to fix the gradle plugin issues
classpath 'com.android.tools.build:gradle:1.5.0'
// TEST
classpath 'junit:junit:4.12'
classpath 'org.mockito:mockito-core:1.10.19'
}
}
apply plugin: 'catkin'
allprojects {
/* A github url provides a good standard unique name for your project */
group 'com.github.sccapstone.robotca'
//version = project.catkin.pkg.version
}
subprojects {
/*
* The android plugin configures a few things:
*
* - local deployment repository : where it dumps the jars and packaged artifacts)
* - local maven repositories : where it finds your locally installed/built artifacts)
* - external maven repositories : where it goes looking if it can't find dependencies locally
* - android build tools version : which version we use across the board
*
* To modify, or add repos to the default external maven repositories list, pull request against this code:
*
* https://github.com/rosjava/rosjava_bootstrap/blob/indigo/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy#L31
*
* To modify the build tools version, pull request against this code:
*
* https://github.com/rosjava/rosjava_bootstrap/blob/indigo/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosAndroid.groovy#L14
*/
apply plugin: 'ros-android'
afterEvaluate { project ->
android {
// Exclude a few files that are duplicated across our dependencies and
// prevent packaging Android applications....
packagingOptions {
exclude "META-INF/LICENSE.txt"
exclude "META-INF/NOTICE.txt"
}
}
}
}
然后在配置的时候,会存在一下网络打不开的情况
运行下面命令
sudo code /etc/hosts --user-data-dir
通过下面网站查询对应网页的ip
https://www.ipaddress.com/
然后修改
配置的时候还可能出现xml1.0与2.0的匹配情况。修改对应的xml文件即可
然后就可以安装此app~
参考资料
https://github.com/rosjava/android_apps
https://www.ncnynl.com/archives/201610/873.html
https://blog.csdn.net/David_Han008/article/details/73864328
https://blog.csdn.net/F_season/article/details/9166133
本文地址:https://blog.csdn.net/gwplovekimi/article/details/107297301
上一篇: Android 播放音乐
下一篇: uboot修改设置boot参数命令
推荐阅读
-
Android开发学习之控件GridView的使用讲解
-
Android开发之ExoPlayer的学习和使用(音频)讲解
-
Android开发学习之Activities页面间的跳转实现
-
ROS学习笔记(3)之ros的topic发送与接收简单实例
-
Android开发学习笔记——四大组件之ContentProvider
-
Android开发之基于RecycleView实现的头部悬浮控件
-
Android开发笔记之如何正确获取WebView的网页Title
-
学习笔记之——基于ROS的Android开发
-
安卓开发学习笔记(五):史上最简单且华丽地实现Android Stutio当中Webview控件https/http协议的方法
-
Android开发学习笔记——Jetpack之WorkManager