Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Autonomous robot, line following and Aruco detection. Android Java

Hi guys, firstly let me thank you for this fantastic library that I´m using on my final mechanical degree project. Basically I´m using a Lego EV3 Mindstorm robot to simulate a warehouse environment, he follows a black line, calculating the center of the line all the time and detecting Aruco markers on the floor. I´m working on a small Android app using Android Studio, I use my mobile phone camera as the robot "eyes", using OpenCV library to process every frame the camera takes, so if the camera doesn´t detect any Aruco marker the robot follows the black line, but if he detects a marker on the floor he turns right/left or goes ahead until next marker. I´ve implemented all of this java code inside onCameraFrame() method, and I´m trying to know if there is a way to detect lines and markers at the same time, using parallel threads, Asynctask... I´m not programmer so I need some tips or guide through where the onCameraFrame method works detecting the center of the line and also detecting Aruco Markers and the same time. I´m using SystemClock.sleep() once the Aruco marker is detected while the robot moves /approach to the marker and then turns left or right, but I also want to draw the Aruco marker on the frame, but it doesn´t happen because drawDetectedMarkers() method is called before return mRgba the Aruco will never be draw on the frame until onCameraFrame finish, the code works like this:

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {

        final Mat mRgba = inputFrame.rgba();

        detectAndDrawMarkers();

        if (corners.size() > 0) {         //if the corners array is bigger than 0 then an Aruco marker has been detected
            drawDetectedMarker(mRgba);    
            turnID(arucoIDs);            //inside this method there is a SystemClock.sleep(), freezing the screen and  waiting until the robot finish the movement
        } else {

            followLine(mRgba);
        }
        return mRgba;
    }

So I need help with:

1) Some way to detect the black line and detect Aruco marker at the same time. 2) Draw the Aruco marker before the frame freeze.

Here is a screenshoot of the frame, there are 2 roi, the green detects the black line center, and the blue one detects the aruco. image description

Thanks so much and best regards.

Autonomous robot, line following and Aruco detection. Android Java

Hi guys, firstly let me thank you for this fantastic library that I´m using on my final mechanical degree project. Basically I´m using a Lego EV3 Mindstorm robot to simulate a warehouse environment, he follows a black line, calculating the center of the line all the time and detecting Aruco markers on the floor. I´m working on a small Android app using Android Studio, I use my mobile phone camera as the robot "eyes", using OpenCV library to process every frame the camera takes, so if the camera doesn´t detect any Aruco marker the robot follows the black line, but if he detects a marker on the floor he turns right/left or goes ahead until next marker. I´ve implemented all of this java code inside onCameraFrame() method, and I´m trying to know if there is a way to detect lines and markers at the same time, using parallel threads, Asynctask... I´m not a programmer so I need some tips or guide through where the onCameraFrame method works detecting the center of the line and also detecting Aruco Markers and the same time. I´m using SystemClock.sleep() once the Aruco marker is detected while the robot moves /approach to the marker and then turns left or right, but I also want to draw the Aruco marker on the frame, but it doesn´t happen because drawDetectedMarkers() method is called before return mRgba the Aruco will never be draw on the frame until onCameraFrame finish, the code works like this:

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {

        final Mat mRgba = inputFrame.rgba();

        detectAndDrawMarkers();

        if (corners.size() > 0) {         //if the corners array is bigger than 0 then an Aruco marker has been detected
            drawDetectedMarker(mRgba);    
            turnID(arucoIDs);            //inside this method there is a SystemClock.sleep(), freezing the screen and  waiting until the robot finish the movement
        } else {

            followLine(mRgba);
        }
        return mRgba;
    }

So I need help with:

1) Some way to detect the black line and detect Aruco marker at the same time. 2) Draw the Aruco marker before the frame freeze.

Here is a screenshoot of the frame, there are 2 roi, the green detects the black line center, and the blue one detects the aruco. image description

Thanks so much and best regards.

Autonomous robot, line following and Aruco detection. Android Java

Hi guys, firstly let me thank you for this fantastic library that I´m using on my final mechanical degree project. Basically I´m using a Lego EV3 Mindstorm robot to simulate a warehouse environment, he follows a black line, calculating the center of the line all the time and detecting Aruco markers on the floor. I´m working on a small Android app using Android Studio, I use my mobile phone camera as the robot "eyes", using OpenCV library to process every frame the camera takes, so if the camera doesn´t detect any Aruco marker the robot follows the black line, but if he detects a marker on the floor he turns right/left or goes ahead until next marker. I´ve implemented all of this java code inside onCameraFrame() method, and I´m trying to know if there is a way to detect lines and markers at the same time, using parallel threads, Asynctask... I´m not a programmer so I need some tips or guide through where the onCameraFrame method works detecting the center of the line and also detecting Aruco Markers and the same time. I´m using Right now the robot does this steps correlatively: 1) Search for Aruco marker on the floor 1.1) If an Aruco marker is detected: draw the marker, call SystemClock.sleep() once the Aruco marker is detected while the robot moves /approach (this freeze the camera), approach to the marker and then slowly and turns left or right, but right depending on the ID of the marker 1.2) If there is no Aruco detected the robot follows the center of the black line

The problem that I also want to draw the Aruco marker on the have is that the method drawDetectedMarkers() doesn´t makes its job, because Aruco marker is not drawed until the mRgba is returned at the end of the camera frame, but so it doesn´t happen because drawDetectedMarkers() method is called before return mRgba the Aruco will never be draw on the frame until onCameraFrame finish, the code works like this:

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {

        final Mat mRgba = inputFrame.rgba();

        detectAndDrawMarkers();

        if (corners.size() > 0) {         //if the corners array is bigger than 0 then an Aruco marker has been detected
            drawDetectedMarker(mRgba);    
            turnID(arucoIDs);            //inside this method there is a SystemClock.sleep(), freezing the screen and  waiting until the robot finish the movement
        } else {

            followLine(mRgba);
        }
        return mRgba;
    }

So I need help with:

1) Some way to detect the black line and detect Aruco marker at the same time. 2) Draw the Aruco marker before the frame freeze.

Here is a screenshoot of the frame, there are 2 roi, the green detects the black line center, and the blue one detects the aruco. image description

Thanks so much and best regards.