Open HelloEgg opened 7 years ago
This issue has been solved..
Not completely but partially
change the dependency of android_10 or android_10 gradle file of each method (android_map_nav... or android_teleop and so on)
Do not put dependency on github source but on your project file.
This is done by typing following code:
compile project(':android_15')
This should allow you to use addlayer method.
Other contributers are still working on what #42 stated however, does not seem to work for now..
I recommend depending on your local project file rather than on github before "addlayer" issue is completely resolved.
Further suggestions or questions are more than welcomed
Hi @HelloEgg ,
I think the problem is the version of Android 15.
All the projects using addLayer
require android_15 version >= 0.3, which would be kinetic branch (that method isn't available in released version 0.2). Something like this:
compile 'org.ros.android_core:android_15:[0.3,0.4)'
That's why when you change it to compile project(':android_15')
it works: you are probably using kinetic branch locally (which is 0.3, but you can also fetch it from Maven).
I need to look into this a little bit further (I get some Sdk errors when I do this dependency upgrade); I will issue a PR when ready.
Hi,@HelloEgg ,@jubeira ,I have a problem when I typing : compile project(':android_15') in build.gradle , when gradle the project ,the erro come up sying : Error:(20, 0) Project with path ':android_15' could not be found in project ':make_a_map'. How can I solve the problem? thank U~
Hi @ZhuJingquan ,
If you write it that way, Gradle will look for a project named android_15 (which is part of android_core
repository) in the defined paths. Do you have a local copy of the code?
If you didn't download android_core, I suggest you to try this option:
-In project's build.gradle, use the following lines:
task wrapper(type: Wrapper) {
gradleVersion = '2.14.1'
}
buildscript {
apply from: "https://github.com/rosjava/android_core/raw/kinetic/buildscript.gradle"
}
(Remember to change the gradle version in your gradle.properties file too to 2.14.1). Then, in the modules that depend on android_15 and fail, replace the compile dependency with this line:
compile 'org.ros.android_core:android_15:[0.3,0.4)'
That will use the released version for android_15
corresponding to the latest kinetic branch.
I will issue a PR with some fixes most likely soon.
Hi, @jubeira ,follow your guide it works!, thank you well much for your in time help!
Hi, @jubeira , Sorry to bother you again, in the make_a_map project I just using method mapView.addLayer() as follow:
mapView.addLayer(viewControlLayer); mapView.addLayer(occupancyGridLayer); mapView.addLayer(laserScanLayer); mapView.addLayer(robotLayer); mapView.addLayer(robotPose); mapView.addLayer(robotPath); mapView.addLayer(viewControlLayer);
but when I open the app ,I could only see the map layer, Could you offer me for some advice ? Thank U~
Hi @ZhuJingquan , sorry, I haven't tried that application in particular. These apps seem to be a little outdated, if you see that there is a problem and you find a way to fix it, please feel free to send a pull request. It will be very welcomed! I will most likely do so with map_nav once I get it to work properly.
@HelloEgg were you able to see the map drawn on the screen with your fix? I got to the point of loading a map, and I can see something when the main view is the camera view, but when I toggle the main view to the map view, I only see a blank image. Does the same happen to you after fixing addLayer
?
Yes. To be exaxt, as I clicked the upper right hand map, the map disappeared and only initial pose and lasers, path appeared. I tracked down the log and It turned outthat occupancy layer(map) was not running. I believe in your case, your ROS does not have initial pose, laser and path module running or you have wrong node topic and name in your android project. However, in either case, I strongly believe that you are not likely to end up with viable solution as the library it self seems to be deprecated. I can asure you that I tried pretty much every possible ways (screen shot of map and adding other modules on top. PS this cannot be a solution because adding the layers it self is ROS android library and it is hard to have separate layers or activity that can go along with it) I am still working on fixing it right, however, for now, I simply made a web app instead of native app, following NAV2djs tutorial and some other html and javascript works. I just simply developed a web site and built a separate android app with WebView that connects to this local website, making it look like some sort of web app. This seems to be a fastest and viable solution to mapnav.. I'm not quite sure about the make a map though because it requires physical manipulation of the robot. To sum up, yes this repository needs further works.
@HelloEgg thanks for your reply. I agree with you, this needs some further works. Right now I'm into something else, so I don't know if I will have the time to fix it.
Just curious, are you using ROS Indigo? I had some troubles to load the map with Kinetic, the packages providing the list_maps
service seem to be out of date too.
My latest PR solves the compiling issues but I'll have to further check the reports of the apps not working as supposed to.
I tried to clone 'indigo''s brach. I noticed that the 'addLayer' part was removed from visualization view and I replaced the code as stated in #42 However, after I replaced mapView.addLayer(viewControlLayer); mapView.addLayer(occupancyGridLayer); mapView.addLayer(laserScanLayer); mapView.addLayer(pathLayer); mapView.addLayer(mapPosePublisherLayer); mapView.addLayer(initialPoseSubscriberLayer);
to
I get the following error: Process: com.github.rosjava.android_apps.map_nav.indigo, PID: 10757 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.IllegalStateException: setRenderer has already been called for this instance. at android.opengl.GLSurfaceView.checkRenderThreadState(GLSurfaceView.java:1935) at android.opengl.GLSurfaceView.setEGLConfigChooser(GLSurfaceView.java:470) at android.opengl.GLSurfaceView.setEGLConfigChooser(GLSurfaceView.java:539) at org.ros.android.view.visualization.VisualizationView.onCreate(VisualizationView.java:81) at com.github.rosjava.android_apps.map_nav.MainActivity.init(MainActivity.java:161) at org.ros.android.RosActivity$2.doInBackground(RosActivity.java:204) at org.ros.android.RosActivity$2.doInBackground(RosActivity.java:201) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)
Originally I assumed that it is because "mapview.oncreate(Lists.newArrayList());" was declared in oncreate method
After I erased that code, new error came up saying:
Process: com.github.rosjava.android_apps.map_nav.indigo, PID: 14839 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.opengl.GLSurfaceView$GLThread.surfaceCreated()' on a null object reference at android.opengl.GLSurfaceView.surfaceCreated(GLSurfaceView.java:629) at android.view.SurfaceView.updateWindow(SurfaceView.java:712) at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:209) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1014) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2560) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1487) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7450) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920) at android.view.Choreographer.doCallbacks(Choreographer.java:695) at android.view.Choreographer.doFrame(Choreographer.java:631) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7229) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I tried checking every single libraries that are stated in error logs but I still cannot figure out what seems to be the problem.. Does any one have any idea? Any suggestion would be appreciated.. If someone knows a directory that works, please do tell me.
My furthest and only assumption is that library is not directed properly..