Let's Make Robots!

Object recognizing

I have written my own coding and got the output in serial terminal window in Program editor for the PART III GET A GRIP. my problem is that how i can differentiate a cup from other object and make the robot understand it. kindly help me i searched the website but i was not able to get it. kindly help me with the code for " how i can make my robot understand that its a cup in front".  i am using PICAXE 28 and SRF005

symbol trig = 3
symbol echo = 6
symbol range = w0
symbol range1 = w1

main:

servo 0,75

pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,85
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif


servo 0,95
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,105
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,115
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,125
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,135
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif


servo 0,145
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif


servo 0,155
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,165
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif


servo 0,175
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,185
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,195
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,205
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif



servo 0,215
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif


servo 0,225
pause 10
pause 10 ' this should not be nesecary, but it was of some reason in my setup

low portc 0 ' this should not be nesecary, but if not, strange things hapened

pause 10 'this should not be nesecary, but that is what makes it all fun

 

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)

pulsin echo,1,range ‘ measures the range in 10uS steps

pause 10

range = range*10/58
range1 = range

if range > 10 then

for b1 = 1 to range1
sertxd ("|")
if b1=range1 then
sertxd("+")
endif
next b1
sertxd(13,10)

else
for b1 = 1 to range1
sertxd("n")
if b1=range1 then

sertxd("+")
endif
next b1
sertxd(13,10)
endif
goto main

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi, First of all, when I kept asking you to post on the project page, when you wrote me by mail and kept on messenging me, you should not post on a seperate forum topic, but as a comment / question on the project page.

Secondly, I'd like to help you, but it is really not possible. You provide a lot of code, and the description of what you'd like as "kindly help me". It is impossible to solve your problem, when I do not know what it is.

The only thing I can say is; Break this down into very.. VERY small bits, and make them work - one at a time.

Once you can document to us that you can scan with the SRF05, and that you have a working version of the project I described (I know I made a full walk through some place, please look for that) - then let me/us know excactly what DETAIL in the project you have a problem with.

Best of all, you should go ahead and try and make your own projects, I think you'd be far better off, and learn a lot more :)

Best of luck.

I would think that object recognition is almost impossible with at ping sensor and a PICAXE. For that you would need a sensor with much higher resolution and something more beefy than that PICAXE.

By looking at your code this would probably be fare beyond your current programming skills.

(you’re doing stuff over and over again, but not a subroutine in sight…)

So take fritsl’s advice. Start with small steps and write some code that works, then build on that.

like Mr Anderson said almost impossible. the best you could get would be to find an object of a certain size, collect and compare all 15 bytes looking for a few that have the same or close values in a cluster , but that wont tell you that it's a cup just an object that's X "Steps " wide

IR beacon would get you to the cup and when your close enough do what ya got to do     

what is best in life ,openCV  computer vision

http://en.wikipedia.org/wiki/OpenCV

and a code tip

http://www.picaxe.com/docs/picaxe_manual2.pdf

Page 66

for b0 = 75 to 225 {step 10}

servo 0,b0
code

code

code

next b0

goto main

i hope this helps 

 

Your questions should not be general.  They need to be specific, otherwise they are too difficult to answer. 

How can I differentiate a cup from other objects and make the robot understand it?

This question needs more detail..
What other objects ?  Any objects? (that would be tough - OpenCV & webcam would be a guess, and this is on a visual level...)

OpenCV is not the only way.. there are many ways to differentiate a cup from other "objects" ... it depends on what is important...

How does a blind person differentiate a cup from other objects?  

Your robot is currently blind, but can ping..  So you have a kind-of echo measuring stick..  If you know where your ping sensor is & you know where you are pointing it, you can begin (with a lot of work) to measure things..  When you can measure things, you can find the dimensions of "object" (after a lot of work)..  With more work you can try to program something which scans for the dimension of an object which might match a "cup" ....   This is after more work..  It will work like crap, but then you can put filtering on it (more work)...

OR you can control and simplify the environment, by putting the cup in a specific location - and the ping sensor only knows if the cup is there.. or if it isn't  (much easier) :)

When you begin to ask yourself these questions, you can start trying to solve all the problems that are important....