erkihindo / controller

Andoid + ROS Indigo + Robot = Magic
18 stars 12 forks source link

Assistance Needed:How to build the project in a pure windows environment in android studio? #2

Open ZhuJingquan opened 7 years ago

ZhuJingquan commented 7 years ago

@shoemakerlevy9 @erkihindo when I downloaded the project and try to open it in android studio,there is something wrong with the build.gradle , at first it reports: image after google ,I add the 'java' plugin,as follow: dependencies { //compile project(':controllerlib') //compile 'org.ros.android_core:android_10:[0.2,0.3)' // apply plugin: 'java' apply plugin: 'java' compile 'org.ros.android_core:android_15:[0.2,0.3)' compile 'com.github.rosjava.android_extras:gingerbread:[0.2,0.3)' compile 'org.ros.rosjava_messages:tf2_msgs:[0.5,0.6)' compile files('libs/msgs.jar') compile files('libs/joystickview.jar') compile 'com.android.support:support-v4:23.2.0' } but new bug report accurs Error:(43, 0) Plugin with id 'com.android.application' not found. Open File

then I google the solution to the situation: I added these codes to the build.gradle file : `buildscript { repositories { jcenter() // or mavenCentral() }

dependencies { classpath 'com.android.tools.build:gradle:1.5.0' } }

allprojects { repositories { jcenter() } }` but new bug reports: Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins. someone say that :"the java plugin and application plugin can't be in one gradle file ",but I still can't solve the problem^

the following is the whole build.gradle file `

dependencies { //compile project(':controllerlib') //compile 'org.ros.android_core:android_10:[0.2,0.3)' // apply plugin: 'java' apply plugin: 'java' compile 'org.ros.android_core:android_15:[0.2,0.3)' compile 'com.github.rosjava.android_extras:gingerbread:[0.2,0.3)' compile 'org.ros.rosjava_messages:tf2_msgs:[0.5,0.6)' compile files('libs/msgs.jar') compile files('libs/joystickview.jar') compile 'com.android.support:support-v4:23.2.0' }

buildscript { repositories { jcenter() // or mavenCentral() }

dependencies { classpath 'com.android.tools.build:gradle:1.5.0' } }

allprojects { repositories { jcenter() } }

apply plugin: 'com.android.application'

android { compileSdkVersion 15 buildToolsVersion "15.0.1" defaultConfig { minSdkVersion 15 applicationId "com.github.ros_java.android_ROS" targetSdkVersion 15 versionCode 1 versionName "1.0" } }

` could you help me to build the project in android studio without ros environment? Thank U~

erkihindo commented 7 years ago

http://stackoverflow.com/questions/26861011/android-compile-error-java-plugin-has-been-applied-not-compatible-with-android

Could this be causing your error message? // apply plugin: 'java' apply plugin: 'java'

ZhuJingquan commented 7 years ago

@erkihindo thank you for your answer, I have compile the project successfullly on Ubuntu via your wiki:https://github.com/erkihindo/controller/wiki/Full-installation-guide but a new problem need your guide:I want to dispaly what the USB_Camera (which is located on my robot ) see,just like the demo you show on Youtube ,and the USB_Camera publish " sensor_msgs/CompressedImage" tpye message,via topic "/camera_node/image_raw/compressed", This is my gui.txt `inputs: -type: slider xy: 0 500 -type: joysticks size: 1250 400 -type: joysticksTable xy: 400 300

listener: -msg_type: msgs/ImageData -topic: /camera_node/image_raw/compressed xy: 200 50

publisher: -topic: /com_cmd msg_type: msgs/Cmd data: leftJSdistance leftJSangle rightJSxangle rightJSup

image_listener: -topic: /camera_node/image_raw/compressed`

but I can't see anything on display ,

while I can see the video stream on rviz;

screenshot from 2017-02-13 17 15 53 rosgraph

How should I edit the gui.txt, thank U~,

erkihindo commented 7 years ago
  1. If you only want to show the video you get from your camera then your gui.txt should only have this: image_listener: -topic: /camera_node/image_raw/compressed

  2. The lines that load the image topic are here: https://github.com/erkihindo/controller/blob/master/src/main/java/com/github/ros_java/android_ROS/controller/Controller.java#L103

  3. When I was testing my app I found that the robot preferred sending the image over 5 GHz Wi-Fi over 2.4GHz, dunno why and dunno how this should help you, but you can try to connect your phone and robot to other Wi-Fi-s. Maybe it'll work