See what Robot Sees

can a task manager even tell
can a task manager even tell wen robots are trying to speak to u?

You are right.However, this

You are right.

However, this post was made before the servopos command was introduced by Picaxe :slight_smile:

 

I have a problem with this

I have a problem with this program precisly the part : “pause 10 low 0 pause 10” when i do this the LED of the SRF05 doesn’t lit and when i press F8 the screen is clear.

When i move “low 0” to the end of the sub puls (just before ‘return’) and i press F8 i see just a few characters (that appears one by one)like that “ö” or “ÿ”.

When i delete “low 0” the servo goes like a drunk rabbit but the LED of the SRF05 is lit and i press F8 i see all this :

"||Üöû~gögö¿ï6ã5þûgï~g~ïvo~ïvo~ïvg~ïvg~ïvïvïöÿ6ã1öûvïvïöïvïöïvïöïvïö?gÿûö?gþû~g~ïvÿ6ãÂöûvïvïöïöïöïöïöïvïöïvïöïöïö?gþûÿ>ã1öûvïö¿ïöïögö¿ïvïöö?gþûö?gþû~g~ïöÿ6ã1öûövïöö?gþûgö¿vïöû~gögï~gvïvÿ6ã1þû~g~ïvïvïvïvïvïvïvïvïvïvïöïöïÿ>ã1jþöïvïvïvovo~gvïvïvïvovïvgvo~gvï6ã1ÿövgþö?gövgþöïvïöïvovïvovovgvg6ã1þöïvoöïvïöïvïvïvovïvovïvgvo~gvo6ãÂö~g~gvo~gvo~gvg~gvg~g~g~g~gg~g>ã1öÿvïvÏvïvÏvovÏvg~Ï~göö?gÿÿvovÏvÿ>ã1þÿö?gÿÿvoÿöïvÏöïvÏvïvÏvovÏvg~Ï~ÿ>ã1öûvïvïvïvïvïvïö?gÿûöïvïvïvïvovïvÿ>ã1öûvovïvovïvïvïvïvïöïvïöïvïvo~ïvÿ>ã1þû~g~ïvovïvovïvo~ïvo~ïvovïvovïvÿ6ã5þûgï~g~ïvg~ïvg~ï~gï~g~ïvovïvÿ6ã5öûvovïvïvïvïvïvïvïvïvïvïvïövïöÿ>ã1öûvïvïöïvïöïöïö?gÿûöïöïö?gþûgö¿ö>ã1ÿûö?oöû~g~ïvg~ïvg~ï~g~ï~g~ïvovïvÿ6ã1öûvïvïö?gÿûö?gþûö?gÿûö?gÿûö?gþûgï~ÿ6ã1bÿvïvovïvgvo~gvg~g~gg~gövïöö?ÿ8ã1ögvovïvovïvovïvgvo~gvgg~gög>ã1þöïvoöïvïöïvovovgvo~g~g~gvovovo6ã1övïvovïvgvg~g~gö??ïvoþövgþöïvovï6ã5ÿÿöïvÏö?göÿvïvÏvovÏvg~Ï~gþgöŸö:ã1öÿö?gÿÿvoÿöïvÏvïvÏvo~Ï~gvÏvo~Ï~ÿ>ã1öûvovïvo~ïvg~ï~g~ï~gïgö¿ïvoööÿ6ãÂöûvovïvïvïvïvïvïvïvo~ïvgïgö¿ï6ã1öûö?gþûgögögö¿ïvïöö?gÿûö?gþûÿ8ã1öûvïvïö;oöû~göö?gÿûö?gÿûö?gþû~g~ïvÿ6ãÂÿûgï~g~ï~g~ï~g~ï~gïgvïö?gþûÿ>ã1öûö?gþûgïgögö¿ïvïög~ïvovïvÿ6ã5öûvïvïöïvïöïvïöïvïöïvïvïvïöïöïöû8ã1öûö?gþûgï~g~ï~g~ï~gï~gvïvïvïöÿ6ã1Â"

How to have ASCII code ? What is the problem with the code ?

Thanks.

 

Perhaps there is a problem

Perhaps there is a problem with your power source. I see jibberish on screen in different micros when batteries are getting low, or the power supply I’m using cannot source enough current for both the micro and the sensor or whatever else is attached.

Could also be caused by a short on either the micro or sensor or cable between causing a power glitch.

I just opened new bateries

I just opened new bateries so it’s not a power problem.

In the code i also changed the symbols echo and trig to set trig =3 and echo =6 refering to the article "How to connect SRF05 to picaxe…"

Should i let them to trig=4 and echo=0 or something because even this doesn’t work ?

Thanks.

No one knows where his the
No one knows where his the problem ?

pins and code
You should plug the SRF05’s connections (echo and puls) to the pins that correspond to those numbers in your code. Or write code that corresponds to where you plugged it in.

Thank you i’ve forgotten to

Thank you i’ve forgotten to change the puls settings, but it’s the same problem don’t see anything in the screen.

My pins configuration is the same as this articles of fritsl How to connect SRF05 to Picaxe 28 pin Project board(https://www.robotshop.com/letsmakerobots/node/66).

I’m using this code :

Symbol servopin = 0’ Defines output pin to which the servo turning the head is connected

symbol trig = 3 ’ Defines output pin for Trigger pulse of SRF05

symbol echo = 6 ’ Defines input pin for Echo pulse of SRF05

symbol servohead = 0 ‘Defines outnput pin for servo to turn SRF05

 

symbol range = w1 ’ 16 bit word variable for range

symbol oldrange = w2’ 16 bit word variable for “Where were we last time?“

symbol calcrange = w3 ’ 16 bit word variable for “The difference”

 

symbol differencebit = 50 ’ sets how little difference we can tolerate to call this “an object"

symbol kopbit = b25 ’ this is overkill and not really used in here, but if you get my way of coding, you may see that it can be used for further investigation to have this variable :wink:

 

main:

for b0 = 75 to 205 step 10

servo servohead, b0

pause 20

 

gosub puls

let range = range / 3

if range > 150 then

range = 150

end if

 

for b1 = 1 to range

sertxd (”|”)

next b1

 

‘’‘

if oldrange > range then

calcrange = oldrange - range

 

if calcrange > differencebit then

kopbit = 1

end if

 

end if

’’‘

if oldrange < range then

calcrange = range - oldrange

 

if calcrange > differencebit then

kopbit = 2

end if

 

end if

’’'

if kopbit = 0 then

sertxd (”(+)")

end if

kopbit = 0

sertxd (13, 10)

 

next b0

sertxd (13, 10)

servo servohead, 75

wait 1

 

goto main

 

 

 

 

‘’’’’’’’’‘PULS’’’’’’’’’’’’

{

puls:

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

low 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

return

}

I have a hard time

I have a hard time understanding your setup, code, what you are doing and what may be wrong. This is why I have not responded.

It would help me if you where very

strict

in your explanation. let me / us know things like

  • what is connected to what, and how
  • excactly what code you are running

- and stuff like that. Formatted (like the examples above).

For me to understand your problem, there is too much confusion, too many places where I do not know if it is this or that that is wrong. Often things like the

’ comments in the code

is causing the confusion and errors, because the ’ -sign is a ´ and things like that. There is no way of telling if this is the case with you.

Screendumps of your (color-marked) code would also help to ensure this.

My connections between the

My connections between the picaxe 28x1 and the srf05 is like in this image :

Output pin for Trigger pulse = 3

Define input pin for Echo pulse= 6

I'm running the same code of yours, i've juste edited the two variables (trig and echo), that's why i won't put the code here because it's the same with just, like a said, the lign 2 and 3 are edited :

symbol trig = 3

symbol echo = 6

****

" ' -sign is a ´" I've replaced all by the correct character.

I don't know if it's still unclear but if it's the case reply me.

Thanks.

Sorry, but I am even more

Sorry, but I am even more confused now.

If you can make a screendump of your code, in the programming editor, and below this tell me what happens, and what you would like to happen instead :slight_smile:

Thanks.

okay, I understood most of

okay, I understood most of the code but there is 1 question buging me,

Let’s say the robot finds an object and stops at certan distance from it, using the code above I want the robot to iddentify if is a upside down cup or not…

what bit of the code do i need to change so that

if object = cup then …

if object <> cup then …

?

Well… sertxd ("(+)")is

Well…

sertxd ("(+)")

is where we tell the display that this is a cup, so that could be a good hook, I suppose. If this part is executed, then it’s a cup! :slight_smile:

Other things?
Could you use the same technique to let the robot understand multiple items, such as a coke bottle AND the tv remote? Or at different angles? (Such as a cup turned sideways?)

Important

Are these code only suitable for sensor SRF05? If Sharp-IR sensor is the case, how do we write the code?

Thanks!

 

It is code written with an

It is code written with an SRF05, and only works for that.

I do not have the time to check this, so chances are that you will have to deal with a few bugs that I make now, but to give you pointers, here is my “on the fly” re-writing of the code, with a Sharp on analogue port 0:

***

Symbol servopin = 0’ Defines output pin to which the servo turning the head is connected

symbol servohead = 0 ‘Defines outnput pin for servo to turn SRF05

 

symbol range = w1 ‘ 16 bit word variable for range

symbol oldrange = w2’ 16 bit word variable for “Where were we last time?“

symbol calcrange = w3 ’ 16 bit word variable for “The difference”

 

symbol differencebit = 50 ’ sets how little difference we can tolerate to call this “an object"

symbol kopbit = b25 ’ this is overkill and not really used in here, but if you get my way of coding, you may see that it can be used for further investigation to have this variable :wink:

 

main:

for b0 = 75 to 205 step 10

servo servohead, b0

pause 20

 

gosub puls

range = range / 3

if range > 150 then

range = 150

end if

 

for b1 = 1 to range

sertxd (”|”)

next b1

 

‘’‘

if oldrange > range then

calcrange = oldrange - range

 

if calcrange > differencebit then

kopbit = 1

end if

 

end if

’’‘

if oldrange < range then

calcrange = range - oldrange

 

if calcrange > differencebit then

kopbit = 2

end if

 

end if

’’'

if kopbit = 0 then

sertxd (”(+)")

end if

kopbit = 0

sertxd (13, 10)

 

next b0

sertxd (13, 10)

servo servohead, 75

wait 1

 

goto main

 

 

 

 

‘’’’’’’’’‘PULS’’’’’’’’’’’’

{

readadc 0, range
return

}

 

Mind you, the sharp returns higher values, the closer the object… or is it the other way around? It is opposite the SRF05, under all circumstances. So object detection will not work out of the box with this code. All I did was inserting the Sharp instead of the SRF05, you should work with it yourself from there :slight_smile:

If you have nothing in the terminal window,

When the terminal window opens, check that it is set to the correct Baud rate.

The first couple of times I tried, the window remained steadfastly empty, but the servo and sensor happily jiggled and pulsed away.

A quick check of the manual (and Frits’ screen shot) reveals that the baud rate in the terminal window must be set to 4800.

CT

 

This is with v5.3.1 of the Picaxe Programming Editor btw.

Oh! Thanks :slight_smile:

Oh! Thanks :slight_smile:

New Code

#terminal 9600
symbol range = w1
main:
     pause 10
     pulsout C.2, 2
     pulsin C.2, 1, w0
     range = w0 * 5 /58 ;Convert to CM
     for b1 = 1 to range
     sertxd ("|")
     next b1
     sertxd (13, 10)
     goto main
This code represents each “|” as 1 cm.
Microbot777

By the way this is in 5.4.2

By the way this is in 5.4.2 Programming Editor