Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Android app to control a Robot that runs kinetic #73

Open
shakthi-prashanth-m opened this issue Jan 16, 2018 · 9 comments
Open

Android app to control a Robot that runs kinetic #73

shakthi-prashanth-m opened this issue Jan 16, 2018 · 9 comments
Labels

Comments

@shakthi-prashanth-m
Copy link

shakthi-prashanth-m commented Jan 16, 2018

Hi I am new to rosjava android.
I am curious to know is it possible to develop Android apps that control Robots (Ubuntu 16.04) running ros-kinetic ?

If yes, I would highly appreciate recommended tutorial that I have to go through to develop one.
Appreciate your help.
Thanks.

@jubeira
Copy link

jubeira commented Jan 22, 2018

Hi @shakthi-prashanth-m,
What type of robot are you trying to control?

If it is an autonomous robot, you can check map_nav inside this repo. It will allow you to send 2D goals to a robot within a map.

http://wiki.ros.org/android This is a good point to get started, and you can also take a look at the source code to see what's happening under the hood.

Does that sound good?

@shakthi-prashanth-m
Copy link
Author

shakthi-prashanth-m commented Jan 22, 2018

Thanks @jubeira . I wanted to develop android application for a Drone.
My goal is to control my Drone using Android app.
As per my understanding, I can do either of them to start with. Please guide me how to get started in either of the steps.

  1. Develop an Android app and run it on emulator that does Takeoff, Land on Simulator on Gazebo.

  2. Write an Android app on Mobile to issue Takeoff, Land commands to a drone running in simulator.
    I am using MAVROS node to talk to drone on simulator.
    Did I sound too technical ?
    I installed rosjava and android_core but I am unable to create a New Project that can link to these workspaces. Is it possible to simply create an android app using Android studio IDE like we do for other apps ?

Thanks

@jubeira
Copy link

jubeira commented Jan 22, 2018

Sounds interesting!
I don't know the internals of MAVROS. Can you control those actions by using services and/ or sending messages to a node contained in MAVROS? If that's the case, you should be able to do it.

To develop with Android Studio, I personally prefer using it together with the standard ros/catkin way of creating packages. Follow these tutorials:

Once you finish creating the package, you will get a Gradle project that you can import with Android Studio. The autogenerated project will have the dependencies set to start developing with ROS Android. You can compile the package using catkin, Gradle or Android Studio.

@shakthi-prashanth-m
Copy link
Author

I don't know the internals of MAVROS. Can you control those actions by using services and/ or sending messages to a node contained in MAVROS? If that's the case, you should be able to do it.

Yes. MAVROS exposes ROS Services to control drone. It supports kinetic version.

Thanks for the pointer to tutorials. I will follow them.

http://wiki.ros.org/rosjava_build_tools/Tutorials/indigo/Creating%20Android%20Packages (creating new ROS Android packages using the command line).

Why indigo ? I wanted to build for kinetic.

@jubeira
Copy link

jubeira commented Jan 23, 2018

Why indigo ? I wanted to build for kinetic.

That's the way the tutorials are linked; always go to the entry point if you have a doubt: https://wiki.ros.org/android. It's the same for Kinetic/ Indigo; the only thing that matters is the version that you specify in your buildscript. The range [0.3, 0.4) should work well for android_core dependencies at Kinetic version.

If you only need an app that triggers services exposed by MAVROS, it should be relatively easy to do.
You will probably need to generate the Java artifacts for those services. You can check here for more info: http://wiki.ros.org/rosjava; in particular, this tutorial provides an example about how how to create custom message artifacts.

@shakthi-prashanth-m
Copy link
Author

@jubeira thank you so much for the detailed help. I will post my result.

@shakthi-prashanth-m
Copy link
Author

shakthi-prashanth-m commented Feb 9, 2018

Hi @jubeira warm greetings!

I followed the tutorials you recommended. I was able to connect my Android phone successfully
to remote roscore as shown Testing Android ROS installation.
Then I proceeded to create Android packages, but its throwing below error.

$ catkin_create_android_project -t 10 -p com.github.ros_java.android_foo.bar bar

Creating android project 
  Name      : bar
  Target Ver: 10
  Java Name : com.github.ros_java.android_foo.bar
  Activity  : Bar

Command: ['android', 'create', 'project', '-n', 'bar', '-p', '/home/intel/android_foo/bar', '-k', 'com.github.ros_java.android_foo.bar', '-t', 'android-10', '-a', 'Bar']
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
Invalid or unsupported command "create project -n bar -p /home/intel/android_foo/bar -k com.github.ros_java.android_foo.bar -t android-10 -a Bar"

Error
[error] __init__() takes at least 3 arguments (2 given) : <type 'exceptions.TypeError'>

android command is deprecated and sdkmanager is recommended. My sdkmanager version is 26.1.1.

$  sdkmanager --version
26.1.1

But, we can't create packages using sdkmanager. What is the alternative ?
Can't I create these packages using Android Studio GUI ?
Appreciate your help.
Thanks.

@jubeira
Copy link

jubeira commented Feb 9, 2018

Hi @shakthi-prashanth-m !

Yes, that is a known issue; you can check rosjava/rosjava_build_tools#32 for more details.
In few words, that is correct: android command was deprecated in newer build tools versions.

You have some options:

  • Download the build tools version indicated in the issue I linked above manually, and replace your current build tools with it
  • Clone android_apps repo and open them in Android Studio. These should have the latest build tools version that works, so Android Studio should download them (do not choose to upgrade them if prompted to do so)
  • Create a project using Android Studio and add the dependencies of Android Core and rosjava as required manually. More details here: http://wiki.ros.org/android/Tutorials/kinetic/Installation%20-%20Android%20Studio%20Development%20Environment

I think option (2) is the easiest, as it doesn't require so many manual steps. Please let me know if that worked for you.

@shakthi-prashanth-m
Copy link
Author

I followed 1st one, and it worked!
Thanks @jubeira !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants