Welcome, Guest. Please Login.
Surveyor Corporation Surveyor SRV-1
Home Help Search Login

Surveyor Robotics Forum

Welcome to the user support forum for Surveyor SRV-1 robots, SRV-1 robot controllers and SVS stereo vision systems. To register for this forum, please send an email to support@surveyor.com which includes your desired forum user name, your registration email address, and a brief explanation of why you wish to join, and we will create a forum account for you.

Please note that there is a Search button in the forum toolbar for forum topics. Another effective search method for the entire surveyor.com site is to use Google, e.g. "xyz site://www.surveyor.com" where "xyz" is the search topic.



Pages: 1 2 
Send Topic Print
Basic object detection? (Read 1787 times)
dbibb
YaBB Newbies
*




Posts: 9
Basic object detection?
04/30/09 at 9:36pm
 
I was wondering how I might do basic wall detection and object avoidance with a C program? My current goal is just to get the SRV to roam around a room avoiding objects, and then hopefully move on to a walled maze. I'm sure this is something I can do easily with the lasers, but can someone point me in the right direction? Thanks!
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: Basic object detection?
Reply #1 - 04/30/09 at 9:50pm
 
Good question.  We haven't posted any practical code examples with the new C interpreter, so this is an ideal opportunity.  We might try to use the lasers and blob detection as a starting point.  I will work on this tomorrow, though others are certainly welcome to jump in.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
dbibb
YaBB Newbies
*




Posts: 9
Re: Basic object detection?
Reply #2 - 04/30/09 at 11:22pm
 
how exactly does vblob() work? and how would you actively analyze images for the lasers while moving?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: Basic object detection?
Reply #3 - 05/01/09 at 7:54am
 
There are two parts to the problem -  
 
1.  an obstacle detection algorithm that uses sensors and processing
2.  a motion control algorithm that applies the results of obstacle detection
 
The main issue with reflected laser light is that it can be confused with other light sources.  If you are confident that the reflected laser light will produce the brightest pixels with the camera, then you can search directly for laser pixels.  Otherwise, the most certain way to resolve this is to capture a frame with the lasers off and compare it with a frame with the lasers on.  As long as the robot or background scene isn't moving, the only image left after subtraction should be the reflected laser light.
 
A good way to test this is to use the SRV1Test application to sample different color ranges and visually observe the results.  From the SRV1Test command window, send
 
'l'  (lower case L) to turn on lasers
'g1' to view color segmentation results
'vc0250255100150100200' to set color bin #0 to Y [250-255], U [100-150], V[100-200]
 
If you only see laser light reflection and no other noise, then you've created a good range of colors.  You can confirm by running the blob command
'vb0'  
and you'll see the coordinates of the reflected light color blobs.
 
You can perform the same functions in the  C interpreter.
 
laser(3);  // turns on both lasers
vcolor(0, 250, 255, 100, 150, 100, 200);  // sets up color bin #0 as above
vcap(); // grabs a video frame
vblob(0,0); // searches for the largest blob matching the color bin #0
 
vblob() actually returns a value which is the number of blobs it finds.  Generally, we're interested in the largest blob, but with two lasers, we should get two blobs, so you might want to look at the details of both blobs.  The results of the blob search are stored in global variables  
    blobcnt (number of pixels in the blob)
    blobx1 (left-most x coordinate)
    blobx2 (right-most x coordinate)
    bloby1 (top y coordinate - 0 is the top row)
    bloby2 (bottom y coordinate)
 
With that information, you have your blob location, so then you have to decide what action to take.  For starters, we should put together a small program that just turns on lasers, does a blob search, and dumps the result.  
 
Back to top
 
« Last Edit: 05/01/09 at 7:57am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
jbourke
Junior Member
**




Posts: 83
Re: Basic object detection?
Reply #4 - 05/01/09 at 10:40am
 
Let me encourage you to use the vision sensor as much as possible.  I have my surveyor running around my house avoiding obstacles using nothing but the image processor (with edge detection enabled).  It wasn't that hard to do.  I haven't even played with the laser rangefinding yet.
 
It does get confused sometimes, but I'm working on improving the edge detection for my purposes.  Since I'm really just looking for the intersection of floor and anything else, I can tune it quite a bit.  The environment I'm mostly concerned with is fairly high contrast.  The floor is dark and the obstacles are light.  It would be hard to use vision sensing on a checkboard floor, of course.  For testing, I've let my 'bot run around the floor of my house, which is a challenge.  Part of my house has tile floors, which cause some problems, but I've played with the firmware to let me give some occasional guidance, and the robot just slows itself down and ultimately stops if it gets confused.
 
Using the lasers could be more reliable, but I bought the surveyor to play with the vision sensing, and my robot is designed to go as fast as possible.  That's hard to do without using vision.  (well, I guess it is just hard to do period)  Even IR and Sonar sensors are problematic when the bot starts moving quickly.
 
One thing that might help is to download Roborealm and play with image processing a bit.  There are a lot of things you can do to segment the floor from the wall.  One thought that might help, but I haven't tried yet, is to replace one of the lasers with a line laser.  This would help with the edge detection tremendously.
 
Jim
Back to top
 
 

About me:
My plane: Russian Thunder: http://www.russianthunder.com
My site(s): RCGroups.com: http://www.rcgroups.com
My software: RealFlight: http://www.realflight.com

WWW   IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: Basic object detection?
Reply #5 - 05/01/09 at 11:09am
 
Jim -
 
I would be interested in your feedback on how we might best use the edge detection function in the picoC environment.  Along those lines, I just posted a note -  
    http://www.surveyor.com/cgi-bin/yabb2/YaBB.pl?num=1241199304
about possibly adding a vfind() function to search a region.  Perhaps we should also add vedge(thresh) to perform the edge filtering and then use vfind() to count the pixels that have been flagged as edges ?
 
The issue with line lasers is that the reflected light is not very bright unless you get a laser with fairly high output.  I agree that it is best to work with image features, though adding a visible light source to the robot can help provide a more stable vision processing environment.   That's actually something we have in the works.
Back to top
 
« Last Edit: 05/01/09 at 11:13am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
jbourke
Junior Member
**




Posts: 83
Re: Basic object detection?
Reply #6 - 05/01/09 at 2:52pm
 
Quote from admin on 05/01/09 at 11:09am:
I would be interested in your feedback on how we might best use the edge detection function in the picoC environment.  

 
I don't feel qualified to give feedback on that because I haven't used the blob functions or picoC yet.  I'm not sure if I will use picoC, actually.  Maybe I just haven't run into the right need yet.
 
Jim
Back to top
 
 

About me:
My plane: Russian Thunder: http://www.russianthunder.com
My site(s): RCGroups.com: http://www.rcgroups.com
My software: RealFlight: http://www.realflight.com

WWW   IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: Basic object detection?
Reply #7 - 05/01/09 at 5:54pm
 
Good suggestions in your other thread about employing edge detection -
       http://www.surveyor.com/cgi-bin/yabb2/YaBB.pl?num=1241221826
 
I will give more thought to the functions in picoC that dbibb needs to accomplish the stated task.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
dbibb
YaBB Newbies
*




Posts: 9
Re: Basic object detection?
Reply #8 - 05/05/09 at 12:29am
 
so once you have the robot in a loop roaming around, how would you tell it to stop with possibly a key command or something?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: Basic object detection?
Reply #9 - 05/05/09 at 2:35am
 
Yes - that is the purpose of the signal() function - it detects if any characters have been received from the host and can be used to break out of a loop.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
mshapiro
Full Member
***




Posts: 145
Re: Basic object detection?
Reply #10 - 05/05/09 at 10:46am
 
Quote from admin on 05/01/09 at 11:09am:
though adding a visible light source to the robot can help provide a more stable vision processing environment.   That's actually something we have in the works.

Since, for me, at least, the lasers have not been as useful as I had hoped, could they be replaced by bright wihite LEDs to light the area ahead of the robot, and thereby eliminate, or at least reduce the problems of low light for the standard camera?  Could multiple LEDs be placed in each circuit?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3675
Re: Basic object detection?
Reply #11 - 05/05/09 at 2:19pm
 
Certainly.  You can put multiple LED's in series, as the voltage drop should be 0.7V per LED.  You can put them in parallel as well, but watch your overall current draw.  There are some very bright LED drivers available as well - Dimension Engineering sells one, and we're aware of another becoming available soon.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
AndreiSk
Full Member
***




Posts: 168
Re: Basic object detection?
Reply #12 - 05/05/09 at 3:00pm
 
Just redesigned my old SRV1q, two photos:
http://81.17.152.8/download/test/CIMG1824.jpg
and http://81.17.152.8/download/test/CIMG1825.jpg
added a) highlight; b) Sharp IR; c) battery indicator; d) usual R/C LiPo 2500mAh
 
Comparision with highlight for OV7725 at 320x240
http://81.17.152.8/download/test/led_on.png
Image may be not so good as expected, because I have long wires between camera and blackfin processor.
But it is clear enough for me.
Back to top
 
 
  IP Logged
jbourke
Junior Member
**




Posts: 83
Re: Basic object detection?
Reply #13 - 05/05/09 at 3:09pm
 
Those sample images really show the value of having a light on the robot.  
 
My friend came up with a fascinating idea.  He proposed using one of the new micro-projectors instead of a lamp.
 
They might not be bright enough yet, but the idea having a controllable light source, that could optionally project a grid, white light, or even a map of some kind, is pretty cool.
 
Something to think about.
 
Jim
Back to top
 
 

About me:
My plane: Russian Thunder: http://www.russianthunder.com
My site(s): RCGroups.com: http://www.rcgroups.com
My software: RealFlight: http://www.realflight.com

WWW   IP Logged
dbibb
YaBB Newbies
*




Posts: 9
Re: Basic object detection?
Reply #14 - 05/08/09 at 1:37am
 
Quote from admin on 05/05/09 at 2:35am:
Yes - that is the purpose of the signal() function - it detects if any characters have been received from the host and can be used to break out of a loop.

 
Quote:
int signal(): non-blocking check for input on serial channel

can you provide an example on how i could utilize this? lets say i am using tera term and xmodem a c test file over that is looping while signal() = 0, how can i send some signal through tera term so signal() no longer returns 0?
Back to top
 
 
  IP Logged
Pages: 1 2 
Send Topic Print