Object detection in area with walls

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, 99jonathan, imaqine

Object detection in area with walls

Postby ak2012 » Fri Feb 15, 2013 6:18 pm

Hello everybody,

I'm encountering a problem with a project we have to do for university. Our task is to build an autonomous robot, which collects coloured tin cans (3 kind of colors, size of a beer can) and brings them to different areas within a field of 2x2 meters, depending on the detected color.

We started small with a simple method to let the robot rotate and stop if it detects a can:
The problem now is that the angle between the object (can) and the robot itself are not properly aligned, apparently because of the ultrasonic signal diffusion.
The code lacks a correction functionality depending on the distance and effect of diffusion.

Code: Select all
boolean minDistReached  = false;
                final int MINDISTANCE = 60;
                int lastDistVal = 0;
               
                while (!minDistReached) {
                        // Auslesen des usSensors
                        minDistReached = usSensor.getDistance() <= MINDISTANCE;
                        lastDistVal = usSensor.getDistance();
                        pilot.setRotateSpeed(18);
                        pilot.rotateRight();   
                        }
                pilot.stop();


Now we figured out a second problem. There will be walls around our 2x2m "robot field". So our robot also has to differ between walls and an actual object.
I tried implementing a method that reads the ultrasonic sensor's value twice with a delay of 100ms and calculates the delta value - this is done in a while-loop which is only left if the delta condition is true. If it's above a certain value, the methods breaks the loop, saves its heading and continues to turn until there is the next drop in the ultrasonic sensor's value, that is when the robot turns away from the object. Then it should stop again, save its position and correct the heading angle by half the amount of the difference and theoretically put the robot in a direct line facing the can. The whole thing with the Pilot / OdometryPoseProvider works, BUT ....

The whole thing works in theory, but actually we have a hard time finding the actual objects, because the "delta triggers" are not triggered. Mostly the reason is measurement errors because the tin cans don't reflect the signal properly. Also corners between two walls lead to heavy distortion.

Do you have any other ideas how we could properly solve this problem?

// Maybe there would be a possibility to check the Pose if it might be that the robot is "looking" into a corner and ignore those values. It might be quite complicated to realize, but just a thought .. I'm not sure whether it's worth an effort.

Thank you in advance!

Best
Aron
ak2012
New User
 
Posts: 7
Joined: Sat Feb 02, 2013 9:01 pm

Re: Object detection in area with walls

Postby roger » Sat Feb 16, 2013 12:45 am

Hi Aron,
As you have discovered, accurate location of a can is difficult because of the beam width of the ultrasonic sensor. One way to reduce the error is to rotate the sensor slowly, measuring the distance continuously; record the angle at which the minimum distance is found. (Is this distance found at only one angle?) Then rotate in the opposite direction, and average the data. For best accuracy, the robot should not move while collecting this data.
Since OdometryPoseProvider gives the robot location, you can determine if the distance and angle you found could be a wall or not.
Another suggestion: You might try mounting your sensors on a vertical axle that is rotated by the third motor, so that you can scan for cans without rotating the robot. Since each robot move increases the error in the calculated pose, so you want to minimize them.
You need to discover the maximum distance at which a can is detectable, and plan your search strategy accordingly.
You could use the measured distance to walls to correct errors in the calculated posse if that is a problem.
Good Luck,
Roger
roger
Moderator
 
Posts: 308
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Re: Object detection in area with walls

Postby ak2012 » Sat Feb 16, 2013 1:36 pm

Hi Roger,

thank you for the input. I also found this: http://lejos.sourceforge.net/nxt/nxj/tu ... ection.htm
Would you rather use the listener/feature detection concept of lejos or implement own code?

To check if it's a wall or can, would you recommend the RangeMape interface or something else?

I'm sorry to ask these question, but I'm honestly really confused with all the different possibilities and which might be the one for our problem.

Thank you in advance!
Best, Aron
ak2012
New User
 
Posts: 7
Joined: Sat Feb 02, 2013 9:01 pm

Re: Object detection in area with walls

Postby gloomyandy » Sat Feb 16, 2013 5:07 pm

I would keep things very simple, just use the standard sensor interface. Then make use of something like the RConsole interface or the logging classes and run lots of tests using the sensor as Roger suggested, look at the distance data you get back (you may want to turn it into a graph) and use these tests to decide what is the best way to identify the can or a wall.

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3003
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Object detection in area with walls

Postby ak2012 » Sun Feb 17, 2013 11:06 am

Hey Andy,

again, thank you very much for you input. I'm going to run several tests with the sensor and try to decide which method works best for us.

Have a great week!
Best, Aron
ak2012
New User
 
Posts: 7
Joined: Sat Feb 02, 2013 9:01 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff