Coder Social home page Coder Social logo

android_extras's Introduction

RosJava

Metapackage for the official rosjava repositories.

See the rosjava_core readme for more details.

android_extras's People

Contributors

adamantivm avatar ashyonline avatar damonkohler avatar sirver avatar stonier avatar stratomda avatar talregev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android_extras's Issues

All sensors pr request

Can you look on my pr of All sensors app?
It an app that send data from phone sensors (camera, location, temperature, magnumeter, illumination gyro and etc) over ros.
very easy to put your phone on robot, and it will be your sensors of robot.

android_tutorial_cv_bridge_image sample dosen't show image

HI! I'm just begin to run the sample android_tutorial_cv_bridge_image and I got some problems.

I have already followed the tutorials to build the environment for rosjava.

Here I want to play a ROS bag file with topic /image_raw and run the app cv bridge image on my phone (Samsung Galaxy J7 Pro) to show the converted video stream.

All I have changed in the MainActivity.java is the topic name which is /camera/image/raw originally. Just like below:

@Override
public void onStart(ConnectedNode connectedNode) {
    this.node = connectedNode;
    final org.apache.commons.logging.Log log = node.getLog();
    imagePublisher = node.newPublisher("/image_converter/output_video/raw", Image._TYPE);
    imageSubscriber = node.newSubscriber("/image_raw", Image._TYPE);
    imageSubscriber.addMessageListener(new MessageListener<Image>() {
        @Override
        public void onNewMessage(Image message) {
            CvImage cvImage;
            try {
                cvImage = CvImage.toCvCopy(message, ImageEncodings.RGB8);
            } catch (Exception e) {
                log.error("cv_bridge exception: " + e.getMessage());
                return;
            }
            Log.i(TAG, Integer.toString(cvImage.image.cols()));
            Log.i(TAG, Integer.toString(cvImage.image.rows()));

            //make sure the picture is big enough for my circle.
            if (cvImage.image.rows() > 110 && cvImage.image.cols() > 110) {
                //place the circle in the middle of the picture with radius 100 and color red.
                Imgproc.circle(cvImage.image, new Point(cvImage.image.cols() / 2, cvImage.image.rows() / 2), 100, new Scalar(255, 0, 0));
            }

            cvImage.image = cvImage.image.t();
            Core.flip(cvImage.image, cvImage.image, 1);

            bmp = Bitmap.createBitmap(cvImage.image.cols(), cvImage.image.rows(), Bitmap.Config.ARGB_8888);
            Utils.matToBitmap(cvImage.image, bmp);
            runOnUiThread(displayImage);

            Core.flip(cvImage.image, cvImage.image, 1);
            cvImage.image = cvImage.image.t();

            try {
                imagePublisher.publish(cvImage.toImageMsg(imagePublisher.newMessage()));
            } catch (IOException e) {
                log.error("cv_bridge exception: " + e.getMessage());
            }
        }
    });
    Log.i(TAG, "called onStart");
}

I played the bag file in my host computer with ROS_IP setting to 192.168.x.x and my app can successfully connect to the address.

However the imageView still shows nothing and
Log.i(TAG, Integer.toString(cvImage.image.cols()));,
Log.i(TAG, Integer.toString(cvImage.image.rows()));
has no info output.

It seems that the MessageListener didn't work and no message is received.

Did I miss something? Hope there's someone can help me! Thanks!

Below is my gradle file:

  • build.gradle(Module: android_extras.cv_bridge)
apply plugin: "com.android.library"

//noinspection GroovyAssignabilityCheck
dependencies {
    compile "org.ros.rosjava_core:rosjava:[0.3,0.4)"
    compile "org.ros.rosjava_messages:sensor_msgs:[1.12,1.13)"
    compile "com.github.rosjava.rosjava_extras:image:[0.3,0.4)"
    compile group: 'org.opencv', name: 'openCVLibrary', version: '3.4.0'
    compile "org.ros.rosjava_messages:std_msgs:[0.5.11,0.6)"
    compile "io.netty:netty:3.5.2.Final"
    compile 'org.ros.rosjava_messages:geometry_msgs:[1.12, 1.13)'
    compile 'org.ros.rosjava_messages:diagnostic_msgs:[1.12, 1.13)'
    compile 'org.ros.rosjava_bootstrap:message_generation:[0.3, 0.4)'
    compile "org.apache.commons:com.springsource.org.apache.commons.logging:[1.1.1,1.2)"
    compile "org.ros.rosjava_messages:sensor_msgs:[1.12, 1.13)"
}

android {
    defaultConfig {
        minSdkVersion 16
    }
}
  • build.gradle(Module: android_extras.android_tutorial_cv_bridge_image)
apply plugin: 'com.android.application'

//noinspection GroovyAssignabilityCheck
dependencies {
    compile 'org.ros.android_core:android_core_components:[0.4,0.5)'
    compile project(":cv_bridge")
}

android {
    defaultConfig {
        minSdkVersion 16
        //noinspection OldTargetApi
        targetSdkVersion 28
    }
}

And the RQT graph:

img

when I run rostopic echo /image_converter/output_video/raw:

img

No resource found

Trying to compile android_extras and I am getting various errors complaining about missing resources.
Here is one example:
"Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'."

@adamantivm Any ideas? Have you compiled android_extras?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.