欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

学习笔记之——基于ROS的Android开发

程序员文章站 2022-04-10 09:37:35
之前博客已经介绍了在linux下安装Android studio《基于linux系统安装Android Studio》,同时也实现了用手机控制turtlebot3的移动。本博文来系统性的学习一下Android与ROS联合开发~ROSJAVAROSjava为ros在java中的通信提供了一个客户端库,以及一系列的核心工具及驱动ROSAndroid参考资料http://wiki.ros.org/rosjavahttp://......

之前博客已经介绍了在linux下安装Android studio《基于linux系统安装Android Studio》,同时也实现了用手机控制turtlebot3的移动。本博文来系统性的学习一下Android与ROS联合开发~

 

目录

ROSJAVA

ROSAndroid

ROS与Android项目

参考资料


 

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/

学习笔记之——基于ROS的Android开发

然后修改

学习笔记之——基于ROS的Android开发

配置的时候还可能出现xml1.0与2.0的匹配情况。修改对应的xml文件即可

学习笔记之——基于ROS的Android开发

然后就可以安装此app~

 

 

 

参考资料

http://wiki.ros.org/rosjava

http://wiki.ros.org/android

https://github.com/rosjava

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 ROS